From b73d2b74873cbe848c6b2ad2a0159ba2880d07ac Mon Sep 17 00:00:00 2001 From: Hinton Date: Thu, 31 Oct 2024 11:58:37 +0100 Subject: [PATCH] Re-work publish workflow to automatically set version if not defined --- ...ish-internal.yml => publish-wasm-internal.yml} | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) rename .github/workflows/{publish-internal.yml => publish-wasm-internal.yml} (84%) diff --git a/.github/workflows/publish-internal.yml b/.github/workflows/publish-wasm-internal.yml similarity index 84% rename from .github/workflows/publish-internal.yml rename to .github/workflows/publish-wasm-internal.yml index eef5b4d0..763dd4f7 100644 --- a/.github/workflows/publish-internal.yml +++ b/.github/workflows/publish-wasm-internal.yml @@ -14,7 +14,7 @@ on: - Dry Run version: description: "Release Version" - required: true + required: false defaults: run: @@ -24,6 +24,8 @@ jobs: setup: name: Setup runs-on: ubuntu-22.04 + outputs: + release-version: ${{ steps.version-output.outputs.version }} steps: - name: Checkout repo uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 @@ -38,6 +40,16 @@ jobs: exit 1 fi + - name: Version output + id: version-output + run: | + if [ -z ${{ inputs.version }} ]; then + VERSION=0.2.0-${{ github.head_ref || github.ref_name }} ${{ github.run_number }} + echo "version=$VERSION" >> $GITHUB_OUTPUT + else + echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT + fi + npm: name: Publish NPM runs-on: ubuntu-22.04 @@ -77,6 +89,7 @@ jobs: npm version --no-git-tag-version ${{ inputs.version }} env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{needs.setup.outputs.release-version}} - name: Setup NPM run: |