Skip to content

Commit

Permalink
Re-work publish workflow to automatically set version if not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
Hinton committed Oct 31, 2024
1 parent 5905354 commit b73d2b7
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- Dry Run
version:
description: "Release Version"
required: true
required: false

defaults:
run:
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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: |
Expand Down

0 comments on commit b73d2b7

Please sign in to comment.