File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Tag Version and Publish on Push to Master
22
33on :
4- push :
4+ pull_request :
5+ types :
6+ - closed
57 branches :
68 - master
79
810jobs :
911 tag_version_and_publish :
12+ if : github.event.pull_request.merged == true
1013
1114 runs-on : self-hosted
1215
@@ -22,20 +25,24 @@ jobs:
2225 - name : Create tag
2326 id : create_tag
2427 run : |
25- # Checks if the tag already exists in the remote repository
28+ # Check if the tag already exists in the remote repository
2629 if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then
27- echo "Error: Tag v${{ env.VERSION }} already exists."
28- exit 1
29- fi
30-
31- # Check if the version was found
32- if [ -z "${{ env.VERSION }}" ]; then
33- echo "Error: No version found in pubspec.yml"
34- exit 1
30+ echo "Tag v${{ env.VERSION }} already exists."
31+ else
32+ # Create and push the new tag
33+ git tag "v${{ env.VERSION }}"
34+ git push origin "v${{ env.VERSION }}"
3535 fi
3636
37- git tag "v${{ env.VERSION }}"
38- git push origin "v${{ env.VERSION }}"
37+ - name : Create release
38+ if : ${{ steps.create_tag.outcome == 'success' }}
39+ uses : softprops/action-gh-release@v2
40+ with :
41+ tag_name : " v${{ env.VERSION }}"
42+ name : " ${{ github.event.pull_request.title }}"
43+ body : " ${{ github.event.pull_request.body }}"
44+ env :
45+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3946
4047 - name : Handle job completion
4148 if : always()
You can’t perform that action at this time.
0 commit comments