Skip to content

Commit 4e3203f

Browse files
maennchenjosevalim
authored andcommitted
Fix Release Signing (#14099) (#14100)
1 parent 4a5fb1e commit 4e3203f

File tree

1 file changed

+85
-53
lines changed

1 file changed

+85
-53
lines changed

.github/workflows/release.yml

Lines changed: 85 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -79,42 +79,6 @@ jobs:
7979
otp: ${{ matrix.otp }}
8080
build_docs: ${{ matrix.build_docs }}
8181

82-
- name: "Sign files with Trusted Signing"
83-
if: github.repository == 'elixir-lang/elixir'
84-
uses: azure/[email protected]
85-
with:
86-
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
87-
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
88-
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
89-
endpoint: https://eus.codesigning.azure.net/
90-
trusted-signing-account-name: trusted-signing-elixir
91-
certificate-profile-name: Elixir
92-
files-folder: ${{ github.workspace }}
93-
files-folder-filter: exe
94-
file-digest: SHA256
95-
timestamp-rfc3161: http://timestamp.acs.microsoft.com
96-
timestamp-digest: SHA256
97-
98-
- name: "Attest release .exe provenance"
99-
uses: actions/attest-build-provenance@v2
100-
id: attest-exe-provenance
101-
with:
102-
subject-path: "elixir-otp-${{ matrix.otp }}.exe"
103-
- name: "Copy release .exe provenance"
104-
run: cp "$ATTESTATION" elixir-otp-${{ matrix.otp }}.exe.sigstore
105-
env:
106-
ATTESTATION: "${{ steps.attest-exe-provenance.outputs.bundle-path }}"
107-
108-
- name: "Attest release .zip provenance"
109-
uses: actions/attest-build-provenance@v2
110-
id: attest-zip-provenance
111-
with:
112-
subject-path: "elixir-otp-${{ matrix.otp }}.zip"
113-
- name: "Copy release .zip provenance"
114-
run: cp "$ATTESTATION" elixir-otp-${{ matrix.otp }}.zip.sigstore
115-
env:
116-
ATTESTATION: "${{ steps.attest-zip-provenance.outputs.bundle-path }}"
117-
11882
- name: "Attest docs provenance"
11983
uses: actions/attest-build-provenance@v2
12084
id: attest-docs-provenance
@@ -127,42 +91,108 @@ jobs:
12791
env:
12892
ATTESTATION: "${{ steps.attest-docs-provenance.outputs.bundle-path }}"
12993

130-
- name: Create Release Hashes
131-
run: |
132-
shasum -a 1 elixir-otp-${{ matrix.otp }}.zip > elixir-otp-${{ matrix.otp }}.zip.sha1sum
133-
shasum -a 256 elixir-otp-${{ matrix.otp }}.zip > elixir-otp-${{ matrix.otp }}.zip.sha256sum
134-
shasum -a 1 elixir-otp-${{ matrix.otp }}.exe > elixir-otp-${{ matrix.otp }}.exe.sha1sum
135-
shasum -a 256 elixir-otp-${{ matrix.otp }}.exe > elixir-otp-${{ matrix.otp }}.exe.sha256sum
13694
- name: Create Docs Hashes
13795
if: ${{ matrix.build_docs }}
13896
run: |
13997
shasum -a 1 Docs.zip > Docs.zip.sha1sum
14098
shasum -a 256 Docs.zip > Docs.zip.sha256sum
14199
142-
- name: "Upload release artifacts"
100+
- name: "Upload linux release artifacts"
101+
uses: actions/upload-artifact@v4
102+
with:
103+
name: build-linux-elixir-otp-${{ matrix.otp }}
104+
path: elixir-otp-${{ matrix.otp }}.zip
105+
106+
- name: "Upload windows release artifacts"
143107
uses: actions/upload-artifact@v4
144108
with:
145-
name: elixir-otp-${{ matrix.otp }}
146-
path: elixir-otp-${{ matrix.otp }}*
109+
name: build-windows-elixir-otp-${{ matrix.otp }}
110+
path: elixir-otp-${{ matrix.otp }}.exe
147111

148112
- name: "Upload doc artifacts"
149113
uses: actions/upload-artifact@v4
150114
if: ${{ matrix.build_docs }}
151115
with:
152116
name: Docs
153117
path: Docs.zip*
118+
119+
sign:
120+
needs: [build]
121+
strategy:
122+
fail-fast: true
123+
matrix:
124+
otp: [26, 27]
125+
flavor: [windows, linux]
154126

155-
upload-release:
156-
needs: [build, create_draft_release]
157-
runs-on: windows-2022
127+
env:
128+
RELEASE_FILE: elixir-otp-${{ matrix.otp }}.${{ matrix.flavor == 'linux' && 'zip' || 'exe' }}
129+
130+
runs-on: ${{ matrix.flavor == 'linux' && 'ubuntu-22.04' || 'windows-2022' }}
158131

159132
steps:
160133
- uses: actions/download-artifact@v4
134+
with:
135+
name: build-${{ matrix.flavor }}-elixir-otp-${{ matrix.otp }}
161136

162-
- run: |
163-
mv elixir-otp-*/* .
164-
mv Docs/* .
137+
- name: "Sign files with Trusted Signing"
138+
if: github.repository == 'elixir-lang/elixir' && matrix.flavor == 'windows'
139+
uses: azure/[email protected]
140+
with:
141+
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
142+
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
143+
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
144+
endpoint: https://eus.codesigning.azure.net/
145+
trusted-signing-account-name: trusted-signing-elixir
146+
certificate-profile-name: Elixir
147+
files-folder: ${{ github.workspace }}
148+
files-folder-filter: exe
149+
file-digest: SHA256
150+
timestamp-rfc3161: http://timestamp.acs.microsoft.com
151+
timestamp-digest: SHA256
152+
153+
- name: "Attest release provenance"
154+
uses: actions/attest-build-provenance@v2
155+
id: attest-provenance
156+
with:
157+
subject-path: ${{ env.RELEASE_FILE }}
158+
- name: "Copy release .zip provenance"
165159
shell: bash
160+
run: cp "$ATTESTATION" "${RELEASE_FILE}.sigstore"
161+
env:
162+
ATTESTATION: "${{ steps.attest-provenance.outputs.bundle-path }}"
163+
164+
- name: Create Release Hashes
165+
if: matrix.flavor == 'windows'
166+
shell: pwsh
167+
run: |
168+
$sha1 = Get-FileHash "$env:RELEASE_FILE" -Algorithm SHA1
169+
$sha1.Hash.ToLower() + " " + $env:RELEASE_FILE | Out-File "$env:RELEASE_FILE.sha1sum"
170+
171+
$sha256 = Get-FileHash "$env:RELEASE_FILE" -Algorithm SHA256
172+
$sha256.Hash.ToLower() + " " + $env:RELEASE_FILE | Out-File "$env:RELEASE_FILE.sha256sum"
173+
174+
- name: Create Release Hashes
175+
if: matrix.flavor == 'linux'
176+
shell: bash
177+
run: |
178+
shasum -a 1 "$RELEASE_FILE" > "${RELEASE_FILE}.sha1sum"
179+
shasum -a 256 "$RELEASE_FILE" > "${RELEASE_FILE}.sha256sum"
180+
181+
- name: "Upload linux release artifacts"
182+
uses: actions/upload-artifact@v4
183+
with:
184+
name: sign-${{ matrix.flavor }}-elixir-otp-${{ matrix.otp }}
185+
path: ${{ env.RELEASE_FILE }}*
186+
187+
upload-release:
188+
needs: [create_draft_release, build, sign]
189+
runs-on: ubuntu-22.04
190+
191+
steps:
192+
- uses: actions/download-artifact@v4
193+
with:
194+
pattern: '{sign-*-elixir-otp-*,Docs}'
195+
merge-multiple: true
166196

167197
- name: Upload Pre-built
168198
shell: bash
@@ -190,7 +220,7 @@ jobs:
190220
Docs.zip.sigstore
191221
192222
upload-builds-hex-pm:
193-
needs: build
223+
needs: [build, sign]
194224
runs-on: ubuntu-22.04
195225
concurrency: builds-hex-pm
196226
env:
@@ -204,6 +234,9 @@ jobs:
204234
OTP_GENERIC_VERSION: "25"
205235
steps:
206236
- uses: actions/download-artifact@v4
237+
with:
238+
pattern: '{sign-*-elixir-otp-*,Docs}'
239+
merge-multiple: true
207240

208241
- name: Init purge keys file
209242
run: |
@@ -213,7 +246,6 @@ jobs:
213246
run: |
214247
ref_name=${{ github.ref_name }}
215248
216-
mv elixir-otp-*/* .
217249
for zip in $(find . -type f -name 'elixir-otp-*.zip' | sed 's/^\.\///'); do
218250
dest=${zip/elixir/${ref_name}}
219251
surrogate_key=${dest/.zip$/}

0 commit comments

Comments
 (0)