chore: Update filenames #182
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Publish Release" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Existing Tag to Publish (eg: v3.7.0)" | |
| type: string | |
| required: true | |
| dual-publish-enabled: | |
| # Set default to true when the dual-publishing period is active | |
| description: "Dual Publish Enabled" | |
| type: boolean | |
| required: false | |
| default: true | |
| dry-run-enabled: | |
| description: "Dry Run Enabled" | |
| type: boolean | |
| required: false | |
| default: false | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| defaults: | |
| run: | |
| shell: bash | |
| permissions: | |
| contents: write | |
| id-token: write | |
| env: | |
| HIERO_PROTO_PKG_NAME: "@hiero-ledger/proto" | |
| HIERO_CRYPTO_PKG_NAME: "@hiero-ledger/cryptography" | |
| HIERO_SDK_PKG_NAME: "@hiero-ledger/sdk" | |
| HASHGRAPH_PROTO_PKG_NAME: "@hashgraph/proto" | |
| HASHGRAPH_CRYPTO_PKG_NAME: "@hashgraph/cryptography" | |
| HASHGRAPH_SDK_PKG_NAME: "@hashgraph/sdk" | |
| jobs: | |
| validate-release: | |
| name: Validate Release | |
| runs-on: hiero-client-sdk-linux-medium | |
| env: | |
| # Set the default to 'true' when the dual-publishing period is active | |
| DUAL_PUBLISH_ENABLED: ${{ inputs.dual-publish-enabled || github.event_name == 'push' }} | |
| outputs: | |
| # Project tag | |
| tag: ${{ steps.tag.outputs.name }} | |
| # main package | |
| sdk-version: ${{ steps.tag.outputs.version }} | |
| sdk-prerelease: ${{ steps.tag.outputs.prerelease }} | |
| sdk-type: ${{ steps.tag.outputs.type }} | |
| hiero-sdk-publish-required: ${{ steps.hiero-sdk-required.outputs.publish-required }} | |
| hashgraph-sdk-publish-required: ${{ steps.sdk-required.outputs.publish-required }} | |
| # proto sub-package | |
| proto-version: ${{ steps.npm-package.outputs.proto-version }} | |
| proto-prerelease: ${{ steps.proto-package.outputs.prerelease }} | |
| proto-type: ${{ steps.proto-package.outputs.type }} | |
| hiero-proto-publish-required: ${{ steps.hiero-proto-required.outputs.publish-required }} | |
| hashgraph-proto-publish-required: ${{ steps.proto-required.outputs.publish-required }} | |
| # crypto sub-package | |
| crypto-version: ${{ steps.npm-package.outputs.crypto-version }} | |
| crypto-prerelease: ${{ steps.crypto-package.output.prerelease }} | |
| crypto-type: ${{ steps.crypto-package.output.type }} | |
| hiero-crypto-publish-required: ${{ steps.hiero-crypto-required.outputs.publish-required }} | |
| hashgraph-crypto-publish-required: ${{ steps.crypto-required.outputs.publish-required }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| ref: ${{ inputs.tag || '' }} | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - 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: Setup JQ | |
| uses: dcarbone/install-jq-action@b7ef57d46ece78760b4019dbc4080a1ba2a40b45 # v3.2.0 | |
| with: | |
| version: 1.7 | |
| - name: Extract NPM Package Versions | |
| id: npm-package | |
| run: | | |
| SDK_PACKAGE_VERSION="$(jq -r '.version' package.json)" | |
| PROTO_PACKAGE_VERSION="$(jq -r '.version' './packages/proto/package.json')" | |
| CRYPTO_PACKAGE_VERSION="$(jq -r '.version' './packages/cryptography/package.json')" | |
| echo "sdk-version=${SDK_PACKAGE_VERSION}" >>"${GITHUB_OUTPUT}" | |
| echo "proto-version=${PROTO_PACKAGE_VERSION}" >>"${GITHUB_OUTPUT}" | |
| echo "crypto-version=${CRYPTO_PACKAGE_VERSION}" >>"${GITHUB_OUTPUT}" | |
| - name: Hiero Proto Subpackage Publish Required | |
| id: hiero-proto-required | |
| if: ${{ env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| run: | | |
| PUBLISH_REQUIRED="false" | |
| if ! curl -sSLf "https://registry.npmjs.org/${{ env.HIERO_PROTO_PKG_NAME }}/${{ steps.npm-package.outputs.proto-version }}" >/dev/null 2>&1; then | |
| PUBLISH_REQUIRED="true" | |
| fi | |
| echo "publish-required=${PUBLISH_REQUIRED}" >>"${GITHUB_OUTPUT}" | |
| - name: Proto Subpackage Publish Required | |
| id: proto-required | |
| run: | | |
| PUBLISH_REQUIRED="false" | |
| if ! curl -sSLf "https://registry.npmjs.org/${{ env.HASHGRAPH_PROTO_PKG_NAME }}/${{ steps.npm-package.outputs.proto-version }}" >/dev/null 2>&1; then | |
| PUBLISH_REQUIRED="true" | |
| fi | |
| echo "publish-required=${PUBLISH_REQUIRED}" >>"${GITHUB_OUTPUT}" | |
| - name: Hiero Crypto Subpackage Publish Required | |
| id: hiero-crypto-required | |
| if: ${{ env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| run: | | |
| PUBLISH_REQUIRED="false" | |
| if ! curl -sSLf "https://registry.npmjs.org/${{ env.HIERO_CRYPTO_PKG_NAME }}/${{ steps.npm-package.outputs.crypto-version }}" >/dev/null 2>&1; then | |
| PUBLISH_REQUIRED="true" | |
| fi | |
| echo "publish-required=${PUBLISH_REQUIRED}" >>"${GITHUB_OUTPUT}" | |
| - name: Crypto Subpackage Publish Required | |
| id: crypto-required | |
| run: | | |
| PUBLISH_REQUIRED="false" | |
| if ! curl -sSLf "https://registry.npmjs.org/${{ env.HASHGRAPH_CRYPTO_PKG_NAME }}/${{ steps.npm-package.outputs.crypto-version }}" >/dev/null 2>&1; then | |
| PUBLISH_REQUIRED="true" | |
| fi | |
| echo "publish-required=${PUBLISH_REQUIRED}" >>"${GITHUB_OUTPUT}" | |
| - name: Hiero SDK Publish Required | |
| id: hiero-sdk-required | |
| if: ${{ env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| run: | | |
| PUBLISH_REQUIRED="false" | |
| if ! curl -sSLf "https://registry.npmjs.org/${{ env.HIERO_SDK_PKG_NAME }}/${{ steps.npm-package.outputs.sdk-version }}" >/dev/null 2>&1; then | |
| PUBLISH_REQUIRED="true" | |
| fi | |
| echo "publish-required=${PUBLISH_REQUIRED}" >>"${GITHUB_OUTPUT}" | |
| - name: SDK Publish Required | |
| id: sdk-required | |
| run: | | |
| PUBLISH_REQUIRED="false" | |
| if ! curl -sSLf "https://registry.npmjs.org/${{ env.HASHGRAPH_SDK_PKG_NAME }}/${{ steps.npm-package.outputs.sdk-version }}" >/dev/null 2>&1; then | |
| PUBLISH_REQUIRED="true" | |
| fi | |
| echo "publish-required=${PUBLISH_REQUIRED}" >>"${GITHUB_OUTPUT}" | |
| - name: Package Version Summary | |
| run: | | |
| echo "## Package Version Summary" >> "${GITHUB_STEP_SUMMARY}" | |
| echo "| Package | Version | Publish Required |" >> "${GITHUB_STEP_SUMMARY}" | |
| echo "|---------|---------|------------------|" >> "${GITHUB_STEP_SUMMARY}" | |
| echo "| ${{ env.HIERO_SDK_PKG_NAME }} | ${{ steps.npm-package.outputs.sdk-version }} | ${{ steps.hiero-sdk-required.outputs.publish-required }} |" >> "${GITHUB_STEP_SUMMARY}" | |
| echo "| ${{ env.HASHGRAPH_SDK_PKG_NAME }} | ${{ steps.npm-package.outputs.sdk-version }} | ${{ steps.sdk-required.outputs.publish-required }} |" >> "${GITHUB_STEP_SUMMARY}" | |
| echo "| ${{ env.HIERO_PROTO_PKG_NAME }} | ${{ steps.npm-package.outputs.proto-version }} | ${{ steps.hiero-proto-required.outputs.publish-required }} |" >> "${GITHUB_STEP_SUMMARY}" | |
| echo "| ${{ env.HASHGRAPH_PROTO_PKG_NAME }} | ${{ steps.npm-package.outputs.proto-version }} | ${{ steps.proto-required.outputs.publish-required }} |" >> "${GITHUB_STEP_SUMMARY}" | |
| echo "| ${{ env.HIERO_CRYPTO_PKG_NAME }} | ${{ steps.npm-package.outputs.crypto-version }} | ${{ steps.hiero-crypto-required.outputs.publish-required }} |" >> "${GITHUB_STEP_SUMMARY}" | |
| echo "| ${{ env.HASHGRAPH_CRYPTO_PKG_NAME }} | ${{ steps.npm-package.outputs.crypto-version }} | ${{ steps.crypto-required.outputs.publish-required }} |" >> "${GITHUB_STEP_SUMMARY}" | |
| - name: Extract SDK Tag Information | |
| id: tag | |
| run: | | |
| REF_NAME="$(git describe --exact-match --tags $(git log -n1 --pretty='%h'))" | |
| IS_VALID_SEMVER="$(semver validate "${REF_NAME}")" | |
| if [[ "${IS_VALID_SEMVER}" != "valid" ]]; then | |
| echo "::error title=Invalid Tag::The tag '${REF_NAME}' is not a valid SemVer tag." | |
| exit 1 | |
| fi | |
| RELEASE_VERSION="$(semver get release "${REF_NAME}")" | |
| PREREL_VERSION="$(semver get prerel "${REF_NAME}")" | |
| PREREL_VERSION_LC="$(printf "%s" "${PREREL_VERSION}" | tr '[:upper:]' '[:lower:]')" | |
| IS_PRERELEASE="false" | |
| [[ -n "${PREREL_VERSION}" ]] && IS_PRERELEASE="true" | |
| PREREL_TYPE="unknown" | |
| if [[ "${IS_PRERELEASE}" == "true" ]]; then | |
| if [[ "${PREREL_VERSION_LC}" =~ "beta" ]]; then | |
| PREREL_TYPE="beta" | |
| else | |
| PREREL_TYPE="unknown" | |
| fi | |
| else | |
| PREREL_TYPE="production" | |
| fi | |
| FINAL_VERSION="${RELEASE_VERSION}" | |
| [[ -n "${PREREL_VERSION}" ]] && FINAL_VERSION="${RELEASE_VERSION}-${PREREL_VERSION}" | |
| TAG_NAME="v${FINAL_VERSION}" | |
| echo "name=${TAG_NAME}" >> "${GITHUB_OUTPUT}" | |
| echo "version=${FINAL_VERSION}" >> "${GITHUB_OUTPUT}" | |
| echo "prerelease=${IS_PRERELEASE}" >> "${GITHUB_OUTPUT}" | |
| echo "type=${PREREL_TYPE}" >> "${GITHUB_OUTPUT}" | |
| echo "## Release Information" >> "${GITHUB_STEP_SUMMARY}" | |
| echo "SDK_VERSION=${FINAL_VERSION}" >> "${GITHUB_STEP_SUMMARY}" | |
| - name: Extract Proto Subpackage Information | |
| id: proto-package | |
| run: | | |
| IS_VALID_SEMVER="$(semver validate "${{ steps.npm-package.outputs.proto-version }}")" | |
| if [[ "${IS_VALID_SEMVER}" != "valid" ]]; then | |
| echo "::error title=Invalid Tag::The tag '${{ steps.npm-package.outputs.proto-version }}' is not a valid SemVer tag." | |
| exit 1 | |
| fi | |
| PREREL_VERSION="$(semver get prerel '${{ steps.npm-package.outputs.proto-version }}')" | |
| PREREL_VERSION_LC="$(printf "%s" "${PREREL_VERSION}" | tr '[:upper:]' '[:lower:]')" | |
| IS_PRERELEASE="false" | |
| [[ -n "${PREREL_VERSION}" ]] && IS_PRERELEASE="true" | |
| PREREL_TYPE="unknown" | |
| if [[ "${IS_PRERELEASE}" == "true" ]]; then | |
| if [[ "${PREREL_VERSION_LC}" =~ "beta" ]]; then | |
| PREREL_TYPE="beta" | |
| else | |
| PREREL_TYPE="unknown" | |
| fi | |
| else | |
| PREREL_TYPE="production" | |
| fi | |
| echo "prerelease=${IS_PRERELEASE}" >>"${GITHUB_OUTPUT}" | |
| echo "type=${PREREL_TYPE}" >>"${GITHUB_OUTPUT}" | |
| - name: Extract Crypto Subpackage Information | |
| id: crypto-package | |
| run: | | |
| IS_VALID_SEMVER="$(semver validate '${{ steps.npm-package.outputs.crypto-version }}')" | |
| if [[ "${IS_VALID_SEMVER}" != "valid" ]]; then | |
| echo "::error title=Invalid Tag::The tag '${{ steps.npm-package.outputs.crypto-version }}' is not a valid SemVer tag." | |
| exit 1 | |
| fi | |
| PREREL_VERSION="$(semver get prerel '${{ steps.npm-package.outputs.crypto-version }}')" | |
| PREREL_VERSION_LC="$(printf "%s" "${PREREL_VERSION}" | tr '[:upper:]' '[:lower:]')" | |
| IS_PRERELEASE="false" | |
| [[ -n "${PREREL_VERSION}" ]] && IS_PRERELEASE="true" | |
| PREREL_TYPE="unknown" | |
| if [[ "${IS_PRERELEASE}" == "true" ]]; then | |
| if [[ "${PREREL_VERSION_LC}" =~ "beta" ]]; then | |
| PREREL_TYPE="beta" | |
| else | |
| PREREL_TYPE="unknown" | |
| fi | |
| else | |
| PREREL_TYPE="production" | |
| fi | |
| echo "prerelease=${IS_PRERELEASE}" >>"${GITHUB_OUTPUT}" | |
| echo "type=${PREREL_TYPE}" >>"${GITHUB_OUTPUT}" | |
| - name: Validate Tag and Package Versions | |
| run: | | |
| COMPARISON_RESULT="$(semver compare "${{ steps.npm-package.outputs.sdk-version }}" "${{ steps.tag.outputs.version }}")" | |
| if [[ "${COMPARISON_RESULT}" -ne 0 ]]; then | |
| echo "::error title=Version Mismatch::The version in package.json (${{ steps.npm-package.outputs.sdk-version }}) does not match the version in the tag (${{ steps.tag.outputs.version }})." | |
| exit 1 | |
| fi | |
| if [[ "${{ steps.tag.outputs.type }}" != "production" && "${{ steps.tag.outputs.type }}" != "beta" ]]; then | |
| echo "::error title=Unsupported PreRelease::The tag '${{ steps.tag.outputs.name }}' is an unsupported prerelease tag. Only 'beta' prereleases are supported." | |
| exit 2 | |
| fi | |
| run-safety-checks: | |
| name: Safety Checks | |
| runs-on: hiero-client-sdk-linux-medium | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| ref: ${{ inputs.tag || '' }} | |
| submodules: recursive | |
| - name: Install Task | |
| uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 | |
| with: | |
| version: 3.35.1 | |
| - name: Install PNPM | |
| uses: step-security/action-setup@3d419c73e38e670dbffe349ffff26dd13c164640 # v4.2.0 | |
| with: | |
| version: 10.17.0 | |
| - name: Setup Node | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
| with: | |
| node-version: 22 | |
| - name: Compile Code | |
| run: | | |
| task -v build | |
| calculate-release-args: | |
| name: Calculate Release Arguments | |
| runs-on: hiero-client-sdk-linux-medium | |
| env: | |
| DRY_RUN_ENABLED: ${{ inputs.dry-run-enabled || 'false'}} | |
| needs: | |
| - validate-release | |
| - run-safety-checks | |
| outputs: | |
| proto-publish-args: ${{ steps.proto-publish-args.outputs.args }} | |
| crypto-publish-args: ${{ steps.crypto-publish-args.outputs.args }} | |
| sdk-publish-args: ${{ steps.sdk-publish-args.outputs.args }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| ref: ${{ inputs.tag || '' }} | |
| submodules: recursive | |
| - name: Calculate Proto Subpackage Publish Arguments | |
| id: proto-publish-args | |
| if: ${{ (needs.validate-release.outputs.hashgraph-proto-publish-required == 'true' || | |
| needs.validate-release.outputs.hiero-proto-publish-required == 'true') && | |
| !cancelled() && !failure() }} | |
| run: | | |
| PUBLISH_ARGS="--access public --no-git-checks" | |
| [[ "${DRY_RUN_ENABLED}" == "true" ]] && PUBLISH_ARGS="${PUBLISH_ARGS} --dry-run" | |
| [[ "${{ needs.validate-release.outputs.proto-prerelease }}" == "true" ]] && PUBLISH_ARGS="${PUBLISH_ARGS} --tag ${{ needs.validate-release.outputs.proto-type }}" | |
| echo "args=${PUBLISH_ARGS}" >> "${GITHUB_OUTPUT}" | |
| working-directory: packages/proto | |
| - name: Calculate Crypto Subpackage Publish Arguments | |
| id: crypto-publish-args | |
| if: ${{ (needs.validate-release.outputs.hashgraph-crypto-publish-required == 'true' || | |
| needs.validate-release.outputs.hiero-crypto-publish-required == 'true') && | |
| !cancelled() && !failure() }} | |
| run: | | |
| PUBLISH_ARGS="--access public --no-git-checks" | |
| [[ "${DRY_RUN_ENABLED}" == "true" ]] && PUBLISH_ARGS="${PUBLISH_ARGS} --dry-run" | |
| [[ "${{ needs.validate-release.outputs.crypto-prerelease }}" == "true" ]] && PUBLISH_ARGS="${PUBLISH_ARGS} --tag ${{ needs.validate-release.outputs.crypto-type }}" | |
| echo "args=${PUBLISH_ARGS}" >>"${GITHUB_OUTPUT}" | |
| working-directory: packages/cryptography | |
| - name: Calculate SDK Publish Arguments | |
| id: sdk-publish-args | |
| if: ${{ (needs.validate-release.outputs.hashgraph-sdk-publish-required == 'true' || | |
| needs.validate-release.outputs.hiero-sdk-publish-required == 'true') && | |
| !cancelled() && !failure() }} | |
| run: | | |
| PUBLISH_ARGS="--access public --no-git-checks" | |
| [[ "${DRY_RUN_ENABLED}" == "true" ]] && PUBLISH_ARGS="${PUBLISH_ARGS} --dry-run" | |
| [[ "${{ needs.validate-release.outputs.sdk-prerelease }}" == "true" ]] && PUBLISH_ARGS="${PUBLISH_ARGS} --tag ${{ needs.validate-release.outputs.sdk-type }}" | |
| echo "args=${PUBLISH_ARGS}" >>"${GITHUB_OUTPUT}" | |
| build-release-package: | |
| name: Build Release Package | |
| runs-on: hiero-client-sdk-linux-large | |
| env: | |
| # Set the default to 'true' when the dual-publishing period is active | |
| DUAL_PUBLISH_ENABLED: ${{ inputs.dual-publish-enabled || github.event_name == 'push' }} | |
| DRY_RUN_ENABLED: ${{ inputs.dry-run-enabled || 'false'}} | |
| needs: | |
| - validate-release | |
| - run-safety-checks | |
| outputs: | |
| hiero-proto-pkg-name: ${{ steps.set-package-names.outputs.hl-proto-pkg-name || '' }} | |
| hiero-crypto-pkg-name: ${{ steps.set-package-names.outputs.hl-crypto-pkg-name || '' }} | |
| hiero-sdk-pkg-name: ${{ steps.set-package-names.outputs.hl-sdk-pkg-name || '' }} | |
| hashgraph-proto-pkg-name: ${{ steps.set-package-names.outputs.hg-proto-pkg-name || '' }} | |
| hashgraph-crypto-pkg-name: ${{ steps.set-package-names.outputs.hg-crypto-pkg-name || '' }} | |
| hashgraph-sdk-pkg-name: ${{ steps.set-package-names.outputs.hg-sdk-pkg-name || '' }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| ref: ${{ inputs.tag || '' }} | |
| submodules: recursive | |
| - name: Install Task | |
| uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 | |
| with: | |
| version: 3.35.1 | |
| - name: Install PNPM | |
| uses: step-security/action-setup@3d419c73e38e670dbffe349ffff26dd13c164640 # v4.2.0 | |
| with: | |
| version: 10.24.0 | |
| - name: Setup Node | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Install NPM Dependencies | |
| run: task -v install | |
| - name: Install Playwright Dependencies | |
| run: sudo npx playwright install-deps | |
| - name: Set Package Names | |
| id: set-package-names | |
| run: | | |
| HL_PROTO_PKG_NAME="${{ format(env.HIERO_PROTO_PKG_NAME, '@', '') }}-${{ needs.validate-release.outputs.proto-version }}.tgz" | |
| HL_CRYPTO_PKG_NAME="${{ format(env.HIERO_CRYPTO_PKG_NAME, '@', '') }}-${{ needs.validate-release.outputs.crypto-version }}.tgz" | |
| HL_SDK_PKG_NAME="${{ format(env.HIERO_SDK_PKG_NAME, '@', '') }}-${{ needs.validate-release.outputs.sdk-version }}.tgz" | |
| HG_PROTO_PKG_NAME="${{ format(env.HASHGRAPH_PROTO_PKG_NAME, '@', '') }}-${{ needs.validate-release.outputs.proto-version }}.tgz" | |
| HG_CRYPTO_PKG_NAME="${{ format(env.HASHGRAPH_CRYPTO_PKG_NAME, '@', '') }}-${{ needs.validate-release.outputs.crypto-version }}.tgz" | |
| HG_SDK_PKG_NAME="${{ format(env.HASHGRAPH_SDK_PKG_NAME, '@', '') }}-${{ needs.validate-release.outputs.sdk-version }}.tgz" | |
| echo "hl-proto-pkg-name=${HL_PROTO_PKG_NAME}" >> "${GITHUB_OUTPUT}" | |
| echo "hl-crypto-pkg-name=${HL_CRYPTO_PKG_NAME}" >> "${GITHUB_OUTPUT}" | |
| echo "hl-sdk-pkg-name=${HL_SDK_PKG_NAME}" >> "${GITHUB_OUTPUT}" | |
| echo "hg-proto-pkg-name=${HG_PROTO_PKG_NAME}" >> "${GITHUB_OUTPUT}" | |
| echo "hg-crypto-pkg-name=${HG_CRYPTO_PKG_NAME}" >> "${GITHUB_OUTPUT}" | |
| echo "hg-sdk-pkg-name=${HG_SDK_PKG_NAME}" >> "${GITHUB_OUTPUT}" | |
| - name: Build Proto Release Package (${{ env.HIERO_PROTO_PKG_NAME }}) | |
| if: ${{ needs.validate-release.outputs.hiero-proto-publish-required == 'true' }} | |
| run: | | |
| task -v pack -- "${{ steps.set-package-names.outputs.hl-proto-pkg-name }}" | |
| working-directory: packages/proto | |
| - name: Upload HL Proto Package Artifact | |
| if: ${{ needs.validate-release.outputs.hiero-proto-publish-required == 'true' }} | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: hl-proto-package | |
| path: packages/proto/${{ steps.set-package-names.outputs.hl-proto-pkg-name }} | |
| if-no-files-found: error | |
| - name: Build Cryptography Release Package (${{ env.HIERO_CRYPTO_PKG_NAME }}) | |
| if: ${{ needs.validate-release.outputs.hiero-crypto-publish-required == 'true' }} | |
| run: | | |
| task -v pack -- "${{ steps.set-package-names.outputs.hl-crypto-pkg-name }}" | |
| working-directory: packages/cryptography | |
| - name: Upload HL Crypto Package Artifact | |
| if: ${{ needs.validate-release.outputs.hiero-crypto-publish-required == 'true' }} | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: hl-crypto-package | |
| path: packages/cryptography/${{ steps.set-package-names.outputs.hl-crypto-pkg-name }} | |
| if-no-files-found: error | |
| - name: Build SDK Release Package (${{ env.HIERO_SDK_PKG_NAME }}) | |
| if: ${{ needs.validate-release.outputs.hiero-sdk-publish-required == 'true' }} | |
| run: | | |
| task -v pack -- "${{ steps.set-package-names.outputs.hl-sdk-pkg-name }}" | |
| - name: Upload HL SDK Package Artifact | |
| if: ${{ needs.validate-release.outputs.hiero-sdk-publish-required == 'true' }} | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: hl-sdk-package | |
| path: ./${{ steps.set-package-names.outputs.hl-sdk-pkg-name }} | |
| if-no-files-found: error | |
| - name: Update Files for Dual Publish | |
| if: ${{ env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| run: | | |
| echo "::group::Update package.json files for dual publish" | |
| files=("package.json" "packages/proto/package.json" "packages/cryptography/package.json") | |
| for file in "${files[@]}"; do | |
| if [[ -f "$file" ]]; then | |
| cp "$file" "$file.tmp" | |
| jq '.name |= sub("@hiero-ledger";"@hashgraph")' "$file.tmp" > "$file" | |
| else | |
| echo "::warning::File $file does not exist, skipping update." | |
| fi | |
| done | |
| find . -type f -name "*.js" -exec sed -i "s/\b@hiero-ledger\/proto\b/@hashgraph\/proto/g" {} + | |
| find . -type f -name "*.js" -exec sed -i "s/\b@hiero-ledger\/cryptography\b/@hashgraph\/cryptography/g" {} + | |
| find . -type f -name "*.js" -exec sed -i "s/\b@hiero-ledger\/sdk\b/@hashgraph\/sdk/g" {} + | |
| echo "::endgroup::" | |
| - name: Run safety checks | |
| run: task -v build | |
| - name: Build Proto Release Package (${{ env.HASHGRAPH_PROTO_PKG_NAME }}) | |
| if: ${{ needs.validate-release.outputs.hashgraph-proto-publish-required == 'true' && env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| run: | | |
| task -v pack -- "${{ steps.set-package-names.outputs.hg-proto-pkg-name }}" | |
| working-directory: packages/proto | |
| - name: Upload HG Proto Package Artifact | |
| if: ${{ needs.validate-release.outputs.hashgraph-proto-publish-required == 'true' && env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: hg-proto-package | |
| path: packages/proto/${{ steps.set-package-names.outputs.hg-proto-pkg-name }} | |
| if-no-files-found: error | |
| - name: Build Cryptography Release Package (${{ env.HASHGRAPH_CRYPTO_PKG_NAME }}) | |
| if: ${{ needs.validate-release.outputs.hashgraph-crypto-publish-required == 'true' && env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| run: | | |
| task -v pack -- "${{ steps.set-package-names.outputs.hg-crypto-pkg-name }}" | |
| working-directory: packages/cryptography | |
| - name: Upload HG Crypto Package Artifact | |
| if: ${{ needs.validate-release.outputs.hashgraph-crypto-publish-required == 'true' && env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: hg-crypto-package | |
| path: packages/cryptography/${{ steps.set-package-names.outputs.hg-crypto-pkg-name }} | |
| if-no-files-found: error | |
| - name: Build SDK Release Package (${{ env.HASHGRAPH_SDK_PKG_NAME }}) | |
| if: ${{ needs.validate-release.outputs.hashgraph-sdk-publish-required == 'true' && env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| run: | | |
| task -v pack -- "${{ steps.set-package-names.outputs.hg-sdk-pkg-name }}" | |
| - name: Upload HG SDK Package Artifact | |
| if: ${{ needs.validate-release.outputs.hashgraph-sdk-publish-required == 'true' && env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: hg-sdk-package | |
| path: ./${{ steps.set-package-names.outputs.hg-sdk-pkg-name }} | |
| if-no-files-found: error | |
| - name: Reset workspace | |
| if: ${{ env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| run: | | |
| echo "::group::Reset workspace" | |
| git reset --hard | |
| git clean -fdx | |
| echo "::endgroup::" | |
| - name: Generate Github Release | |
| uses: step-security/release-action@03a57407052f15d1537fd5469a6fbbc536aba326 # v1.20.0 | |
| if: ${{ env.DRY_RUN_ENABLED != 'true' }} | |
| with: | |
| tag: ${{ needs.validate-release.outputs.tag }} | |
| prerelease: ${{ needs.validate-release.outputs.prerelease == 'true' }} | |
| draft: false | |
| generateReleaseNotes: true | |
| skipIfReleaseExists: true | |
| publish-release: | |
| name: Publish Release Packages | |
| runs-on: ubuntu-latest | |
| needs: | |
| - calculate-release-args | |
| - build-release-package | |
| - validate-release | |
| env: | |
| # Set the default to 'true' when the dual-publishing period is active | |
| DUAL_PUBLISH_ENABLED: ${{ inputs.dual-publish-enabled || github.event_name == 'push' }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| ref: ${{ inputs.tag || '' }} | |
| submodules: recursive | |
| - name: Install Task | |
| uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 | |
| with: | |
| version: 3.35.1 | |
| - name: Install PNPM | |
| uses: step-security/action-setup@3d419c73e38e670dbffe349ffff26dd13c164640 # v4.2.0 | |
| with: | |
| version: 10.24.0 | |
| - name: Setup Node | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| # Publish proto artifacts | |
| - name: Download HL Proto Package Artifact | |
| if: ${{ needs.validate-release.outputs.hiero-proto-publish-required == 'true' }} | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| name: hl-proto-package | |
| path: packages/proto | |
| - name: Download HG Proto Package Artifact | |
| if: ${{ needs.validate-release.outputs.hashgraph-proto-publish-required == 'true' && env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| name: hg-proto-package | |
| path: packages/proto | |
| - name: Publish Proto Release (${{ env.HIERO_PROTO_PKG_NAME }}) | |
| if: ${{ needs.validate-release.outputs.hiero-proto-publish-required == 'true' }} | |
| run: | | |
| task -v publish ${{ needs.build-release-package.outputs.hiero-proto-pkg-name }} -- ${{ needs.calculate-release-args.outputs.proto-publish-args }} | |
| working-directory: packages/proto | |
| - name: Publish Proto Release (${{ env.HASHGRAPH_PROTO_PKG_NAME }}) | |
| if: ${{ needs.validate-release.outputs.hashgraph-proto-publish-required == 'true' && env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| run: | | |
| task -v publish ${{ needs.build-release-package.outputs.hashgraph-proto-pkg-name }} -- ${{ needs.calculate-release-args.outputs.proto-publish-args }} | |
| working-directory: packages/proto | |
| # Publish cryptography artifacts | |
| - name: Download HL Crypto Package Artifact | |
| if: ${{ needs.validate-release.outputs.hiero-crypto-publish-required == 'true' }} | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| name: hl-crypto-package | |
| path: packages/cryptography | |
| - name: Download HG Crypto Package Artifact | |
| if: ${{ needs.validate-release.outputs.hashgraph-crypto-publish-required == 'true' && env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| name: hg-crypto-package | |
| path: packages/cryptography | |
| - name: Publish Cryptography Release (${{ env.HIERO_CRYPTO_PKG_NAME }}) | |
| if: ${{ needs.validate-release.outputs.hiero-crypto-publish-required == 'true' }} | |
| run: | | |
| task -v publish ${{ needs.build-release-package.outputs.hiero-crypto-pkg-name }} -- ${{ needs.calculate-release-args.outputs.crypto-publish-args }} | |
| working-directory: packages/cryptography | |
| - name: Publish Cryptography Release (${{ env.HASHGRAPH_CRYPTO_PKG_NAME }}) | |
| if: ${{ needs.validate-release.outputs.hashgraph-crypto-publish-required == 'true' && env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| run: | | |
| task -v publish ${{ needs.build-release-package.outputs.hashgraph-crypto-pkg-name }} -- ${{ needs.calculate-release-args.outputs.crypto-publish-args }} | |
| working-directory: packages/cryptography | |
| # Publish SDK artifacts | |
| - name: Download HL SDK Package Artifact | |
| if: ${{ needs.validate-release.outputs.hiero-sdk-publish-required == 'true' }} | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| name: hl-sdk-package | |
| - name: Download HG SDK Package Artifact | |
| if: ${{ needs.validate-release.outputs.hashgraph-sdk-publish-required == 'true' && env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| name: hg-sdk-package | |
| - name: Publish SDK Release (${{ env.HIERO_SDK_PKG_NAME }}) | |
| if: ${{ needs.validate-release.outputs.hiero-sdk-publish-required == 'true' }} | |
| run: | | |
| task -v publish ${{ needs.build-release-package.outputs.hiero-sdk-pkg-name }} -- ${{ needs.calculate-release-args.outputs.sdk-publish-args }} | |
| - name: Publish SDK Release (${{ env.HASHGRAPH_SDK_PKG_NAME }}) | |
| if: ${{ needs.validate-release.outputs.hashgraph-sdk-publish-required == 'true' && env.DUAL_PUBLISH_ENABLED == 'true' }} | |
| run: | | |
| task -v publish ${{ needs.build-release-package.outputs.hashgraph-sdk-pkg-name }} -- ${{ needs.calculate-release-args.outputs.sdk-publish-args }} |