1818 if : github.event_name == 'push' && github.ref == 'refs/heads/main'
1919 outputs :
2020 new_tag : ${{ steps.tag_version.outputs.new_tag }}
21- tag_created : ${{ steps.tag_version.outputs.tag_created }}
21+ tag_created : ${{ steps.tag_version.outputs.new_tag != '' }}
2222 permissions :
2323 contents : write
2424 steps :
@@ -39,12 +39,14 @@ jobs:
3939 - name : Print Tag Info
4040 run : |
4141 echo "New tag: ${{ steps.tag_version.outputs.new_tag }}"
42- echo "Tag created: ${{ steps.tag_version.outputs.tag_created }}"
42+ echo "Tag created: ${{ steps.tag_version.outputs.new_tag != '' }}"
4343
4444 build :
4545 name : Build Go Binary
4646 runs-on : ${{ matrix.os }}
4747 needs : auto-tag
48+ # Always run build, even if auto-tag was skipped (e.g., for tag pushes)
49+ if : always() && (needs.auto-tag.result == 'success' || needs.auto-tag.result == 'skipped')
4850 strategy :
4951 matrix :
5052 os : [ubuntu-latest, windows-latest, macos-latest]
6264 steps :
6365 - name : Checkout code
6466 uses : actions/checkout@v4
65- with :
66- ref : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.auto-tag.outputs.tag_created == 'true' && needs.auto-tag.outputs.new_tag || github.ref }}
6767
6868 - name : Set up Go
6969 uses : actions/setup-go@v5
8989 path : ${{ matrix.artifact_name }}
9090
9191 release :
92+ name : Create Release
9293 needs : [auto-tag, build]
93- # Run if a tag was created or if this was triggered by a tag push
94- if : (needs.auto-tag.outputs.tag_created == 'true ') || (github.event_name == 'push' && contains(github.ref, 'refs/tags/'))
94+ # Run if a tag was created by auto-tag or this is a tag push
95+ if : (needs.auto-tag.outputs.new_tag != ' ') || (github.event_name == 'push' && contains(github.ref, 'refs/tags/'))
9596 runs-on : ubuntu-latest
9697 permissions :
9798 contents : write
@@ -106,47 +107,38 @@ jobs:
106107 run : |
107108 echo "GitHub ref: ${{ github.ref }}"
108109 echo "Event name: ${{ github.event_name }}"
109- echo "Auto tag created: ${{ needs.auto-tag.outputs.tag_created }}"
110110 echo "New tag: ${{ needs.auto-tag.outputs.new_tag }}"
111- ls -la
111+ echo "Directory contents:"
112+ find . -type f | sort
112113
113114 - name : Create Release
114115 id : create_release
115116 uses : softprops/action-gh-release@v1
116117 env :
117118 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
118119 with :
119- tag_name : ${{ needs.auto-tag.outputs.tag_created == 'true' && needs.auto-tag.outputs.new_tag || github.ref_name }}
120+ tag_name : ${{ needs.auto-tag.outputs.new_tag != '' && needs.auto-tag.outputs.new_tag || github.ref_name }}
121+ name : Release ${{ needs.auto-tag.outputs.new_tag != '' && needs.auto-tag.outputs.new_tag || github.ref_name }}
120122 files : |
121- commit-linux-amd64/commit
122- commit-windows-amd64.exe/commit.exe
123- commit-macos-amd64/commit
123+ ./ commit-linux-amd64/commit
124+ ./ commit-windows-amd64.exe/commit.exe
125+ ./ commit-macos-amd64/commit
124126 draft : false
125127 prerelease : false
126128 generate_release_notes : true
127129
128130 publish :
129131 name : Publish to GitHub Packages
130132 needs : [auto-tag, build]
131- # Run if a tag was created or if this was triggered by a tag push
132- if : (needs.auto-tag.outputs.tag_created == 'true ') || (github.event_name == 'push' && contains(github.ref, 'refs/tags/'))
133+ # Run if a tag was created by auto-tag or this is a tag push
134+ if : (needs.auto-tag.outputs.new_tag != ' ') || (github.event_name == 'push' && contains(github.ref, 'refs/tags/'))
133135 runs-on : ubuntu-latest
136+ permissions :
137+ contents : write
134138 steps :
135139 - name : Checkout code
136140 uses : actions/checkout@v4
137141
138- - name : Debug info
139- run : |
140- echo "GitHub ref: ${{ github.ref }}"
141- echo "Event name: ${{ github.event_name }}"
142- echo "Auto tag created: ${{ needs.auto-tag.outputs.tag_created }}"
143- echo "New tag: ${{ needs.auto-tag.outputs.new_tag }}"
144-
145- - name : Set up Go
146- uses : actions/setup-go@v5
147- with :
148- go-version : ' 1.22'
149-
150142 - name : Download Linux artifact
151143 uses : actions/download-artifact@v4
152144 with :
@@ -165,14 +157,10 @@ jobs:
165157 name : commit-macos-amd64
166158 path : ./dist/darwin-amd64
167159
168- - name : List artifacts
160+ - name : Debug info
169161 run : |
170- echo "Linux artifacts:"
171- ls -la ./dist/linux-amd64/ || echo "Directory not found"
172- echo "Windows artifacts:"
173- ls -la ./dist/windows-amd64/ || echo "Directory not found"
174- echo "macOS artifacts:"
175- ls -la ./dist/darwin-amd64/ || echo "Directory not found"
162+ echo "Directory contents:"
163+ find ./dist -type f | sort
176164
177165 - name : Make binaries executable
178166 run : |
@@ -200,7 +188,7 @@ jobs:
200188 env :
201189 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
202190 with :
203- tag_name : ${{ needs.auto-tag.outputs.tag_created == 'true ' && needs.auto-tag.outputs.new_tag || github.ref_name }}
191+ tag_name : ${{ needs.auto-tag.outputs.new_tag != ' ' && needs.auto-tag.outputs.new_tag || github.ref_name }}
204192 files : |
205193 ./release/commit-linux-amd64.tar.gz
206194 ./release/commit-windows-amd64.zip
0 commit comments