1212 build-all :
1313 name : Build All Architectures
1414 runs-on : ubuntu-latest
15+ outputs :
16+ suffix : ${{ steps.version.outputs.suffix }}
1517
1618 steps :
1719 - name : Checkout code
@@ -29,11 +31,24 @@ jobs:
2931 go clean -cache -modcache -i -r || true
3032 echo "Go environment cleaned"
3133
34+ - name : Determine version
35+ id : version
36+ run : |
37+ if [[ "${{ github.ref_type }}" == "tag" ]]; then
38+ echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
39+ echo "suffix=${{ github.ref_name }}_" >> $GITHUB_OUTPUT
40+ echo "Building with version: ${{ github.ref_name }}"
41+ else
42+ echo "version=" >> $GITHUB_OUTPUT
43+ echo "suffix=" >> $GITHUB_OUTPUT
44+ echo "Building without version (non-tag build)"
45+ fi
46+
3247 - name : Build all architectures using make
3348 run : |
3449 set -e
3550 echo "Building all architectures..."
36- if ! make release-build; then
51+ if ! make release-build VERSION="${{ steps.version.outputs.version }}" ; then
3752 echo "❌ Build failed"
3853 exit 1
3954 fi
@@ -56,24 +71,24 @@ jobs:
5671 with :
5772 name : linux-binaries
5873 path : |
59- kubectl-oadp_${{ github.ref_name }}_linux_amd64
60- kubectl-oadp_${{ github.ref_name }}_linux_arm64
74+ kubectl-oadp_${{ steps.version.outputs.suffix }}linux_amd64
75+ kubectl-oadp_${{ steps.version.outputs.suffix }}linux_arm64
6176
6277 - name : Upload macOS binaries
6378 uses : actions/upload-artifact@v4
6479 with :
6580 name : macos-binaries
6681 path : |
67- kubectl-oadp_${{ github.ref_name }}_darwin_amd64
68- kubectl-oadp_${{ github.ref_name }}_darwin_arm64
82+ kubectl-oadp_${{ steps.version.outputs.suffix }}darwin_amd64
83+ kubectl-oadp_${{ steps.version.outputs.suffix }}darwin_arm64
6984
7085 - name : Upload Windows binaries
7186 uses : actions/upload-artifact@v4
7287 with :
7388 name : windows-binaries
7489 path : |
75- kubectl-oadp_${{ github.ref_name }}_windows_amd64 .exe
76- kubectl-oadp_${{ github.ref_name }}_windows_arm64 .exe
90+ kubectl-oadp_${{ steps.version.outputs.suffix }}windows_amd64 .exe
91+ kubectl-oadp_${{ steps.version.outputs.suffix }}windows_arm64 .exe
7792
7893 - name : Run host tests
7994 run : |
@@ -95,10 +110,10 @@ jobs:
95110 include :
96111 - os : ubuntu-latest
97112 arch : amd64
98- binary : kubectl-oadp_${{ github.ref_name }}_linux_amd64
113+ binary : kubectl-oadp_${{ needs.build-all.outputs.suffix }}linux_amd64
99114 - os : ubuntu-24.04-arm
100115 arch : arm64
101- binary : kubectl-oadp_${{ github.ref_name }}_linux_arm64
116+ binary : kubectl-oadp_${{ needs.build-all.outputs.suffix }}linux_arm64
102117
103118 runs-on : ${{ matrix.os }}
104119
@@ -202,10 +217,10 @@ jobs:
202217 include :
203218 - os : macos-13 # Intel
204219 arch : amd64
205- binary : kubectl-oadp_${{ github.ref_name }}_darwin_amd64
220+ binary : kubectl-oadp_${{ needs.build-all.outputs.suffix }}darwin_amd64
206221 - os : macos-latest # Apple Silicon
207222 arch : arm64
208- binary : kubectl-oadp_${{ github.ref_name }}_darwin_arm64
223+ binary : kubectl-oadp_${{ needs.build-all.outputs.suffix }}darwin_arm64
209224
210225 runs-on : ${{ matrix.os }}
211226
@@ -309,10 +324,10 @@ jobs:
309324 include :
310325 - os : windows-latest # amd64
311326 arch : amd64
312- binary : kubectl-oadp_${{ github.ref_name }}_windows_amd64 .exe
327+ binary : kubectl-oadp_${{ needs.build-all.outputs.suffix }}windows_amd64 .exe
313328 - os : windows-11-arm # arm64
314329 arch : arm64
315- binary : kubectl-oadp_${{ github.ref_name }}_windows_arm64 .exe
330+ binary : kubectl-oadp_${{ needs.build-all.outputs.suffix }}windows_arm64 .exe
316331
317332 runs-on : ${{ matrix.os }}
318333
0 commit comments