@@ -3,11 +3,15 @@ run-name: Initiated by ${{ github.actor }}
33# Run on main branch with tag v*.*.*
44on :
55 push :
6+ branches :
7+ - main
68 tags :
79 - v*.*.*
810jobs :
911 build :
1012 runs-on : ubuntu-latest
13+ outputs :
14+ tag : ${{ steps.get_tag.outputs.tag }}
1115 steps :
1216 - uses : actions/checkout@v2
1317 - uses : actions/setup-node@v2
@@ -24,10 +28,17 @@ jobs:
2428 COMMIT_APP_BASE_URL : https://app.commit.dev
2529 COMMIT_AUTH0_DOMAIN : https://commitdev.auth0.com
2630 COMMIT_CLIENT_ID : ${{ secrets.COMMIT_CLIENT_ID_STAGING }}
31+ # Get most recent tag
32+ - name : Get most recent tag
33+ id : get_tag
34+ run : echo name=tag::$(git describe --tags `git rev-list --tags --max-count=1`) >> $GITHUB_OUTPUT
35+ # Rename the VSIX file to the version number
36+ - name : Rename VSIX file
37+ run : mv *.vsix commit-extension-${{ steps.get_tag.outputs.tag }}.vsix
2738 # Upload the VSIX file as an artifact with version number
2839 - uses : actions/upload-artifact@v3
2940 with :
30- name : commit-extension
41+ name : commit-extension-${{ steps.get_tag.outputs.tag }}
3142 path : ./*.vsix
3243
3344 # Create a release with the version number
3849 # Download the VSIX file from the artifact
3950 - uses : actions/download-artifact@v2
4051 with :
41- name : commit-extension
52+ name : commit-extension-${{ needs.build.outputs.tag }}
4253 path : ./
4354
55+ # Check if the release already exists
56+ - name : Check if release exists
57+ id : check_release
58+ uses : softprops/action-gh-release@v1
59+ with :
60+ tag_name : ${{ needs.build.outputs.tag }}
61+ env :
62+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
63+
64+ # If the release already exists then exit
65+ - name : Exit if release exists
66+ if : ${{ steps.check_release.outputs.exists == 'true' }}
67+ run : exit 0
68+
4469 # Upload the VSIX file to the Github release
4570 - name : Create Release
4671 uses : softprops/action-gh-release@v1
0 commit comments