Skip to content

Replaced / with OS-dependent path separator in the importedFileName… #58

Replaced / with OS-dependent path separator in the importedFileName…

Replaced / with OS-dependent path separator in the importedFileName… #58

name: "Deploy Release Artifact"
on:
workflow_dispatch:
inputs:
java-version:
description: "Java JDK Version:"
type: string
required: false
default: "17.0.5"
java-distribution:
description: "Java JDK Distribution:"
type: string
required: false
default: "temurin"
gradle-version:
description: "Gradle Version:"
type: string
required: false
default: "wrapper"
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+-?*"
defaults:
run:
shell: bash
permissions:
contents: read
env:
LC_ALL: C.UTF-8
jobs:
prepare-tag-release:
name: Release / Tag / Prepare
runs-on: [ self-hosted, Linux, pbj, standard, ephemeral ]
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
outputs:
version: ${{ steps.tag.outputs.version }}
prerelease: ${{ steps.tag.outputs.prerelease }}
steps:
- name: Install Semantic Version Tools
run: |
echo "::group::Download SemVer Binary"
sudo curl -L -o /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver
echo "::endgroup::"
echo "::group::Change SemVer Binary Permissions"
sudo chmod -v +x /usr/local/bin/semver
echo "::endgroup::"
echo "::group::Show SemVer Binary Version Info"
semver --version
echo "::endgroup::"
- name: Extract Tag Version
id: tag
run: |
RELEASE_VERSION="$(semver get release "${{ github.ref_name }}")"
PRERELEASE_VERSION="$(semver get prerel "${{ github.ref_name }}")"
FINAL_VERSION="${RELEASE_VERSION}"
PRERELEASE_FLAG="false"
[[ -n "${PRERELEASE_VERSION}" ]] && FINAL_VERSION="${RELEASE_VERSION}-${PRERELEASE_VERSION}"
[[ -n "${PRERELEASE_VERSION}" ]] && PRERELEASE_FLAG="true"
echo "version=${FINAL_VERSION}" >>"${GITHUB_OUTPUT}"
echo "prerelease=${PRERELEASE_FLAG}" >>"${GITHUB_OUTPUT}"
prepare-mc-release:
name: Release / MC / Prepare
runs-on: [ self-hosted, Linux, pbj, standard, ephemeral ]
needs:
- prepare-tag-release
outputs:
payload: ${{ steps.dispatch.outputs.payload }}
if: ${{ always() }}
steps:
- name: Install JSON Tools
run: |
if ! command -v jq >/dev/null 2>&1; then
echo "::group::Setup JQ Command"
sudo apt update
sudo apt install -y jq
echo "::endgroup::"
fi
JQ_VERSION="$(jq --version)"
if [[ "${JQ_VERSION}" != "jq-1.6" ]]; then
echo "::group::Updating JQ Version"
sudo apt update
sudo apt upgrade -y jq
echo "::endgroup::"
fi
if ! command -v tee >/dev/null 2>&1; then
echo "::group::Setup Tee Command"
sudo apt update
sudo apt install -y coreutils
echo "::endgroup::"
fi
echo "::group::Show JQ Version"
jq --version
echo "::endgroup::"
- name: Prepare Dispatch Payload
id: dispatch
env:
REQ_IS_TAG_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
run: |
VERSION_POLICY="snapshot"
VERSION_NUM=""
if [[ -n "${REQ_IS_TAG_PUSH}" && "${REQ_IS_TAG_PUSH}" == true ]]; then
VERSION_POLICY="specified"
VERSION_NUM="${{ needs.prepare-tag-release.outputs.version }}"
fi
REQ_JSON="$(jq --compact-output --null-input \
--arg ref "${{ github.ref }}" \
--arg jdist "${{ github.event.inputs.java-distribution || 'temurin' }}" \
--arg jver "${{ github.event.inputs.java-version || '17.0.5' }}" \
--arg gver "${{ github.event.inputs.gradle-version || 'wrapper' }}" \
--arg vpol "${VERSION_POLICY}" \
--arg vnum "${VERSION_NUM}" \
'{"ref": $ref, "java": {"distribution": $jdist, "version": $jver}, "gradle": {"version": $gver}, "release": {"version": {"policy": $vpol, "number": $vnum}}}')"
echo "payload=${REQ_JSON}" >>"${GITHUB_OUTPUT}"
printf "## Dispatch Payload\n\`\`\`json\n%s\n\`\`\`\n" "$(jq '.' <<<"${REQ_JSON}")" >>"${GITHUB_STEP_SUMMARY}"
dispatch-mc-release:
name: Release / MC / Dispatch
runs-on: [ self-hosted, Linux, pbj, standard, ephemeral ]
needs:
- prepare-mc-release
if: ${{ needs.prepare-mc-release.result == 'success' && always() }}
steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.GH_REPO_DISPATCH_TOKEN }}
repository: hashgraph/hedera-internal-workflows
event-type: pbj-mc-release
client-payload: ${{ needs.prepare-mc-release.outputs.payload }}