1212 goarch :
1313 required : true
1414 type : string
15+ runner_os :
16+ required : false
17+ type : string
18+ default : ubuntu-24.04
1519
1620env :
1721 # renovate: datasource=github-tags depName=goreleaser-pro packageName=goreleaser/goreleaser-pro
@@ -21,26 +25,18 @@ jobs:
2125 prepare :
2226 strategy :
2327 matrix :
24- GOOS : ${{ fromJSON( inputs.goos) }}
25- GOARCH : ${{ fromJSON( inputs.goarch) }}
28+ GOOS : ${{ fromJSON(inputs.goos) }}
29+ GOARCH : ${{ fromJSON(inputs.goarch) }}
2630 exclude :
2731 - GOOS : darwin
2832 GOARCH : " 386"
2933 - GOOS : darwin
3034 GOARCH : s390x
31- - GOOS : windows
32- GOARCH : arm64
33- - GOOS : darwin
34- GOARCH : arm
35- - GOOS : windows
36- GOARCH : arm
37- - GOOS : windows
38- GOARCH : s390x
3935 - GOOS : darwin
4036 GOARCH : ppc64le
41- - GOOS : windows
42- GOARCH : ppc64le
43- runs-on : ubuntu-24.04
37+ - GOOS : darwin
38+ GOARCH : arm
39+ runs-on : ${{ inputs.runner_os }}
4440
4541 steps :
4642 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -52,22 +48,28 @@ jobs:
5248 - uses : anchore/sbom-action/download-syft@f325610c9f50a54015d37c8d16cb3b0e2c8f4de0 # v0.18.0
5349
5450 - uses : docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
51+ if : runner.os != 'Windows'
5552 with :
5653 platforms : arm64,ppc64le,linux/arm/v7,s390x
5754
5855 - uses : docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
56+ if : runner.os != 'Windows'
57+
58+ # Fix slow Go compile and cache restore
59+ # See https://github.com/actions/setup-go/pull/515
60+ - name : Fix slow setup-go cache restore in Windows
61+ if : runner.os == 'Windows'
62+ run : |
63+ echo "GOCACHE=D:\gocache" | Out-File -FilePath $env:GITHUB_ENV -Append
64+ echo "GOMODCACHE=D:\gomodcache" | Out-File -FilePath $env:GITHUB_ENV -Append
65+ echo "GOTMPDIR=D:\gotmp" | Out-File -FilePath $env:GITHUB_ENV -Append
66+ mkdir D:\gotmp
5967
6068 - uses : actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
6169 with :
6270 go-version : " ~1.24"
6371 check-latest : true
6472
65- - name : Setup wixl # Required to build MSI packages for Windows
66- if : ${{ matrix.GOOS == 'windows' && ( matrix.GOARCH == '386' || matrix.GOARCH == 'amd64') }}
67- run : |
68- sudo apt-get update
69- sudo apt-get install -y wixl
70-
7173 - name : Generate distribution sources
7274 run : make generate-sources
7375
8688
8789 - name : Create artifacts directory to store build artifacts
8890 if : inputs.distribution == 'otelcol-contrib'
91+ shell : bash
8992 run : mkdir -p distributions/otelcol-contrib/artifacts
9093
9194 # otelcol-contrib is built in a separate stage
@@ -109,10 +112,12 @@ jobs:
109112
110113 - name : Move built artifacts
111114 if : inputs.distribution == 'otelcol-contrib'
115+ shell : bash
112116 run : mv distributions/otelcol-contrib/dist/**/* distributions/otelcol-contrib/artifacts/
113117
114118 - name : Show built or downloaded content
115119 if : inputs.distribution == 'otelcol-contrib'
120+ shell : bash
116121 run : ls -laR distributions/otelcol-contrib/artifacts
117122
118123 - uses : goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1
@@ -137,7 +142,7 @@ jobs:
137142
138143 release :
139144 name : ${{ inputs.distribution }} Release
140- runs-on : ubuntu-24.04
145+ runs-on : ${{ inputs.runner_os }}
141146 needs : prepare
142147
143148 permissions :
@@ -155,23 +160,51 @@ jobs:
155160 - uses : anchore/sbom-action/download-syft@f325610c9f50a54015d37c8d16cb3b0e2c8f4de0 # v0.18.0
156161
157162 - uses : docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
163+ if : runner.os != 'Windows'
158164 with :
159165 platforms : arm64,ppc64le,s390x
160166
161167 - uses : docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
168+ if : runner.os != 'Windows'
169+
170+ # Fix slow Go compile and cache restore
171+ # See https://github.com/actions/setup-go/pull/515
172+ - name : Fix slow setup-go cache restore in Windows
173+ if : runner.os == 'Windows'
174+ run : |
175+ echo "GOCACHE=D:\gocache" | Out-File -FilePath $env:GITHUB_ENV -Append
176+ echo "GOMODCACHE=D:\gomodcache" | Out-File -FilePath $env:GITHUB_ENV -Append
177+ echo "GOTMPDIR=D:\gotmp" | Out-File -FilePath $env:GITHUB_ENV -Append
178+ mkdir D:\gotmp
162179
163180 - uses : actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
164181 with :
165182 go-version : " ~1.24"
166183 check-latest : true
167184
168185 - uses : actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
186+ if : runner.os == 'Windows'
187+ with :
188+ pattern : artifacts-${{ inputs.distribution }}-windows-*
189+ path : distributions/${{ inputs.distribution }}/dist
190+ merge-multiple : true
191+
192+ - uses : actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
193+ if : runner.os != 'Windows'
194+ with :
195+ pattern : artifacts-${{ inputs.distribution }}-darwin-*
196+ path : distributions/${{ inputs.distribution }}/dist
197+ merge-multiple : true
198+
199+ - uses : actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
200+ if : runner.os != 'Windows'
169201 with :
170- pattern : artifacts-${{ inputs.distribution }}-*
202+ pattern : artifacts-${{ inputs.distribution }}-linux- *
171203 path : distributions/${{ inputs.distribution }}/dist
172204 merge-multiple : true
173205
174206 - name : Display structure of downloaded files
207+ shell : bash
175208 run : ls -R distributions/${{ inputs.distribution }}/dist
176209
177210 - name : Log into Docker.io
0 commit comments