From 3e361c3c2c5738fe6b8bb5d41b1fa9998ab08231 Mon Sep 17 00:00:00 2001 From: Jeppe Rask Date: Sat, 20 Aug 2022 17:24:40 +0200 Subject: [PATCH] Added verifying version before creating release --- .github/workflows/release.yml | 10 +++++----- ci/verifyVersion.sh | 9 +++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100755 ci/verifyVersion.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 065efe6..df26682 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,19 +27,19 @@ jobs: zip -r -j static.zip dist/* - name: Get version - run: echo "::set-output name=version::$(./ci/getVersion.sh)" + run: echo "::set-output name=version::v$(./ci/getVersion.sh)" id: version - # - name: Verify version - # run: | - # ./ci/verifyVersion.sh + - name: Verify version + run: | + ./ci/verifyVersion.sh ${{ steps.version.outputs.version }} # Verify changelog has entry with new version - name: Release uses: softprops/action-gh-release@v1 with: name: ${{ steps.version.outputs.version }} - tag_name: v${{ steps.version.outputs.version }} + tag_name: ${{ steps.version.outputs.version }} files: static.zip fail_on_unmatched_files: true prerelease: false diff --git a/ci/verifyVersion.sh b/ci/verifyVersion.sh new file mode 100755 index 0000000..75ac0eb --- /dev/null +++ b/ci/verifyVersion.sh @@ -0,0 +1,9 @@ +VERSION=$1 +TAG_EXISTS=$(git ls-remote --tags origin $VERSION | wc -l) + +if [ $TAG_EXISTS -eq "1" ]; then + echo "The tag '$VERSION' already exists. Please update version in package.json."; + exit 1; +fi + +echo "The tag '$VERSION' does not exist - success."; \ No newline at end of file