diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8e0e497..a288ea5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,10 @@ on: tags: - 'v*' workflow_dispatch: + inputs: + version: + description: 'Version to release' + required: true jobs: release: @@ -23,6 +27,20 @@ jobs: - name: Install dependencies run: npm install + - name: Extract version from tag or dispatch + id: get_version + run: | + if [ "${{ github.event_name }}" == "push" ]; then + echo "Version from tag ${GITHUB_REF##*/}" + echo "::set-output name=version::${GITHUB_REF##*/v}" + elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + echo "Version from dispatch input ${{ github.event.inputs.version }}" + echo "::set-output name=version::${{ github.event.inputs.version }}" + fi + + - name: Update version in package.json + run: npm version ${{ steps.get_version.outputs.version }} --no-git-tag-version + - name: Build run: npm run build @@ -37,4 +55,4 @@ jobs: - name: Publish env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npm publish -r --access public --no-git-checks + run: npm publish --access public --no-git-checks