Skip to content

Commit

Permalink
tag commit on release
Browse files Browse the repository at this point in the history
  • Loading branch information
CluEleSsUK committed Feb 5, 2024
1 parent 14c75ed commit cddc1f7
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ jobs:
with:
node-version: latest

- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: npm ci

Expand All @@ -29,6 +35,7 @@ jobs:
run: npm test

- name: Check for version change
id: version-check
run: |
[ "$(git show head^:package.json | jq .version)" = "$(cat package.json| jq .version)" ] && echo "::set-output name=version_changed::true" || echo "::set-output name=version_changed::false"
Expand All @@ -45,6 +52,15 @@ jobs:
# don't try and deploy if versions haven't changed
check-version: true

- name: Publish to github
- name: Create tag variable
id: tagging
if: github.ref == 'refs/heads/master' && steps.version-check.outputs.version_changed == 'true'
run: npm run publish:github
run: echo "::set-output name=new_tag::v$(cat package.json | jq .version | sed "s/['\"]//g")"

- name: Create a GitHub release
if: github.ref == 'refs/heads/master' && steps.version-check.outputs.version_changed == 'true'
uses: ncipollo/release-action@v1
with:
custom_tag: ${{ steps.tagging.outputs.new_tag }}
name: Release ${{ steps.tagging.outputs.new_tag }]
body: ${{ steps.tag_version.outputs.changelog }}

0 comments on commit cddc1f7

Please sign in to comment.