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