Skip to content

Commit

Permalink
ci: update version with tag name
Browse files Browse the repository at this point in the history
  • Loading branch information
Bloomingg authored Dec 24, 2024
1 parent 178580a commit 58891a4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true

jobs:
release:
Expand All @@ -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

Expand All @@ -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

0 comments on commit 58891a4

Please sign in to comment.