1818 fail-fast : false
1919 matrix :
2020 build_type : [Release]
21- c_compiler : [gcc, clang ]
22- cpp_compiler : [g++, clang++ ]
21+ c_compiler : [gcc]
22+ cpp_compiler : [g++]
2323
2424 steps :
2525 - uses : actions/checkout@v4
@@ -67,10 +67,22 @@ jobs:
6767 with :
6868 name : project-release
6969
70+ - name : Extract tag name
71+ id : extract_tag
72+ run : |
73+ # Extract tag name from refs/tags/ or refs/heads/
74+ ref=${{ github.ref }}
75+ if [[ "$ref" == refs/tags/* ]]; then
76+ tag_name=${ref#refs/tags/}
77+ else
78+ tag_name=${ref#refs/heads/}
79+ fi
80+ echo "tag_name=$tag_name" >> $GITHUB_ENV
81+
7082 - name : Check if release already exists
7183 id : check_release
7284 run : |
73- if gh release view ${{ github.ref }}; then
85+ if gh release view ${{ env.tag_name }}; then
7486 echo "Release already exists."
7587 echo "release-exists=true" >> $GITHUB_ENV
7688 else
@@ -84,11 +96,11 @@ jobs:
8496 env :
8597 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
8698 with :
87- tag_name : ${{ github.ref }}
88- release_name : " Release ${{ github.ref }}"
99+ tag_name : ${{ env.tag_name }}
100+ release_name : " Release ${{ env.tag_name }}"
89101 draft : false
90102 prerelease : false
91- body : " Automated release for version ${{ github.ref }}."
103+ body : " Automated release for version ${{ env.tag_name }}."
92104
93105 - name : Upload release asset
94106 if : env.release-exists == 'false'
0 commit comments