From 3ec81867888d40b8f954179d0d17444bf0d07c4c Mon Sep 17 00:00:00 2001 From: tim-s-ccs Date: Tue, 27 Aug 2024 11:27:22 +0100 Subject: [PATCH] Update the release action --- .github/workflows/release.yml | 30 ++++++++++++++++-------------- .nvmrc | 1 + 2 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 .nvmrc diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc2b780..f05129a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,24 +11,26 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Check to see if the package version has changed - id: check-package-version - uses: EndBug/version-check@v2.1.4 - - - name: Echo change - run: 'echo "Changed: ${{ steps.check-package-version.outputs.changed }}"' + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + registry-url: "https://registry.npmjs.org" - - name: End if no changes where found - run: 'echo "CANCELLING WORKFLOW: No package version changes found"' - if: steps.check-package-version.outputs.changed == 'false' + - name: Get package version + id: package_version + run: echo "npm=$(npm run version --silent)" >> $GITHUB_OUTPUT - - name: Log when changed - run: 'echo "New version: ${{ steps.check-package-version.outputs.version }} (${{ steps.check-package-version.outputs.type }})"' - if: steps.check-package-version.outputs.changed == 'true' + - name: Check if version tag already exists + id: version_tag + uses: mukunku/tag-exists-action@bdad1eaa119ce71b150b952c97351c75025c06a9 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag: v${{ steps.package_version.outputs.npm }} - name: Create GitHub release uses: softprops/action-gh-release@v2 with: - tag_name: v${{ steps.check-package-version.outputs.version }} + tag_name: v${{ steps.package_version.outputs.npm }} generate_release_notes: true - if: steps.check-package-version.outputs.changed == 'true' + if: steps.version_tag.outputs.exists == 'false' diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..0a47c85 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +lts/iron \ No newline at end of file