Skip to content

Commit 499e185

Browse files
committed
Upload release signatures to GitHub automatically
1 parent b1a8f60 commit 499e185

File tree

3 files changed

+65
-51
lines changed

3 files changed

+65
-51
lines changed

.github/workflows/release-verify-signatures.yml

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,42 @@
11
name: Reproducible binary
22

3+
# This workflow waits for release signatures to appear on Maven Central,
4+
# then rebuilds the artifacts and verifies them against those signatures,
5+
# and finally uploads the signatures to the GitHub release.
6+
37
on:
48
release:
59
types: [published, edited]
610

711
jobs:
12+
download:
13+
name: Download keys and signatures
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Fetch keys
18+
run: gpg --no-default-keyring --keyring ./yubico.keyring --keyserver hkps://keys.openpgp.org --recv-keys 57A9DEED4C6D962A923BB691816F3ED99921835E
19+
20+
- name: Download signatures from Maven Central
21+
timeout-minutes: 60
22+
run: |
23+
until wget https://repo1.maven.org/maven2/com/yubico/webauthn-server-attestation/${{ github.ref_name }}/webauthn-server-attestation-${{ github.ref_name }}.jar.asc; do sleep 180; done
24+
until wget https://repo1.maven.org/maven2/com/yubico/webauthn-server-core/${{ github.ref_name }}/webauthn-server-core-${{ github.ref_name }}.jar.asc; do sleep 180; done
25+
26+
- name: Store keyring and signatures as artifact
27+
uses: actions/upload-artifact@v3
28+
with:
29+
name: keyring-and-signatures
30+
retention-days: 1
31+
path: |
32+
yubico.keyring
33+
*.jar.asc
34+
835
verify:
936
name: Verify signatures (JDK ${{ matrix.java }} ${{ matrix.distribution }})
10-
37+
needs: download
1138
runs-on: ubuntu-latest
39+
1240
strategy:
1341
matrix:
1442
java: [17]
@@ -31,21 +59,34 @@ jobs:
3159
java --version
3260
./gradlew jar
3361
34-
- name: Fetch keys
35-
run: gpg --no-default-keyring --keyring ./yubico.keyring --keyserver hkps://keys.openpgp.org --recv-keys 57A9DEED4C6D962A923BB691816F3ED99921835E
62+
- name: Retrieve keyring and signatures
63+
uses: actions/download-artifact@v3
64+
with:
65+
name: keyring-and-signatures
3666

37-
- name: Verify signatures from GitHub release
67+
- name: Verify signatures from Maven Central
3868
run: |
39-
wget https://github.com/${GITHUB_REPOSITORY}/releases/download/${{ github.ref_name }}/webauthn-server-attestation-${{ github.ref_name }}.jar.asc
40-
wget https://github.com/${GITHUB_REPOSITORY}/releases/download/${{ github.ref_name }}/webauthn-server-core-${{ github.ref_name }}.jar.asc
41-
4269
gpg --no-default-keyring --keyring ./yubico.keyring --verify webauthn-server-attestation-${{ github.ref_name }}.jar.asc webauthn-server-attestation/build/libs/webauthn-server-attestation-${{ github.ref_name }}.jar
4370
gpg --no-default-keyring --keyring ./yubico.keyring --verify webauthn-server-core-${{ github.ref_name }}.jar.asc webauthn-server-core/build/libs/webauthn-server-core-${{ github.ref_name }}.jar
4471
45-
- name: Verify signatures from Maven Central
72+
upload:
73+
name: Upload signatures to GitHub
74+
needs: verify
75+
runs-on: ubuntu-latest
76+
77+
permissions:
78+
contents: write # Allow uploading release artifacts
79+
80+
steps:
81+
- name: Retrieve signatures
82+
uses: actions/download-artifact@v3
83+
with:
84+
name: keyring-and-signatures
85+
86+
- name: Upload signatures to GitHub
4687
run: |
47-
wget -O webauthn-server-core-${{ github.ref_name }}.jar.mavencentral.asc https://repo1.maven.org/maven2/com/yubico/webauthn-server-core/${{ github.ref_name }}/webauthn-server-core-${{ github.ref_name }}.jar.asc
48-
wget -O webauthn-server-attestation-${{ github.ref_name }}.jar.mavencentral.asc https://repo1.maven.org/maven2/com/yubico/webauthn-server-attestation/${{ github.ref_name }}/webauthn-server-attestation-${{ github.ref_name }}.jar.asc
88+
RELEASE_DATA=$(curl -H "Authorization: Bearer ${{ github.token }}" ${{ github.api_url }}/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }})
89+
UPLOAD_URL=$(jq -r .upload_url <<<"${RELEASE_DATA}" | sed 's/{?name,label}//')
4990
50-
gpg --no-default-keyring --keyring ./yubico.keyring --verify webauthn-server-attestation-${{ github.ref_name }}.jar.mavencentral.asc webauthn-server-attestation/build/libs/webauthn-server-attestation-${{ github.ref_name }}.jar
51-
gpg --no-default-keyring --keyring ./yubico.keyring --verify webauthn-server-core-${{ github.ref_name }}.jar.mavencentral.asc webauthn-server-core/build/libs/webauthn-server-core-${{ github.ref_name }}.jar
91+
curl -X POST -H "Authorization: Bearer ${{ github.token }}" -H 'Content-Type: text/plain' --data-binary @webauthn-server-attestation-${{ github.ref_name }}.jar.asc "${UPLOAD_URL}?name=webauthn-server-attestation-${{ github.ref_name }}.jar.asc"
92+
curl -X POST -H "Authorization: Bearer ${{ github.token }}" -H 'Content-Type: text/plain' --data-binary @webauthn-server-core-${{ github.ref_name }}.jar.asc "${UPLOAD_URL}?name=webauthn-server-core-${{ github.ref_name }}.jar.asc"

build.gradle

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,6 @@ task assembleJavadoc(type: Sync) {
116116
destinationDir = file("${rootProject.buildDir}/javadoc")
117117
}
118118

119-
task collectSignatures(type: Sync) {
120-
destinationDir = file("${rootProject.buildDir}/dist")
121-
duplicatesStrategy DuplicatesStrategy.FAIL
122-
include '*.jar', '*.jar.asc'
123-
}
124-
125119
subprojects { project ->
126120

127121
if (project.plugins.hasPlugin('scala')) {
@@ -247,14 +241,6 @@ subprojects { project ->
247241
useGpgCmd()
248242
sign publishing.publications.jars
249243
}
250-
251-
tasks.withType(Sign) { Sign signTask ->
252-
rootProject.tasks.collectSignatures {
253-
from signTask.inputs.files
254-
from signTask.outputs.files
255-
}
256-
signTask.finalizedBy rootProject.tasks.collectSignatures
257-
}
258244
}
259245
}
260246

doc/releasing.md

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,7 @@ Release candidate versions
2828
$ ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
2929
```
3030
31-
6. Wait for the artifacts to become downloadable at
32-
https://repo1.maven.org/maven2/com/yubico/webauthn-server-core/ . This is
33-
needed for one of the GitHub Actions release workflows and usually takes
34-
less than 30 minutes (long before the artifacts become searchable on the
35-
main Maven Central website).
36-
37-
7. Push to GitHub.
31+
6. Push to GitHub.
3832
3933
If the pre-release makes significant changes to the project README, such
4034
that the README does not accurately reflect the latest non-pre-release
@@ -52,19 +46,19 @@ Release candidate versions
5246
$ git push origin main 1.4.0-RC1
5347
```
5448
55-
8. Make GitHub release.
49+
7. Make GitHub release.
5650
5751
- Use the new tag as the release tag
5852
- Check the pre-release checkbox
5953
- Copy the release notes from `NEWS` into the GitHub release notes; reformat
6054
from ASCIIdoc to Markdown and remove line wraps. Include only
6155
changes/additions since the previous release or pre-release.
62-
- Attach the signature files from
63-
`build/dist/webauthn-server-attestation-X.Y.Z-RCN.jar.asc`
64-
and
65-
`build/dist/webauthn-server-core-X.Y.Z-RCN.jar.asc`.
6656
- Note which JDK version was used to build the artifacts.
6757
58+
8. Check that the ["Reproducible binary"
59+
workflow](/Yubico/java-webauthn-server/actions/workflows/release-verify-signatures.yml)
60+
runs and succeeds.
61+
6862
6963
Release versions
7064
---
@@ -128,27 +122,20 @@ Release versions
128122
$ ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
129123
```
130124
131-
11. Wait for the artifacts to become downloadable at
132-
https://repo1.maven.org/maven2/com/yubico/webauthn-server-core/ . This is
133-
needed for one of the GitHub Actions release workflows and usually takes
134-
less than 30 minutes (long before the artifacts become searchable on the
135-
main Maven Central website).
136-
137-
12. Push to GitHub:
125+
11. Push to GitHub:
138126
139127
```
140128
$ git push origin main 1.4.0
141129
```
142130
143-
13. Make GitHub release.
131+
12. Make GitHub release.
144132
145133
- Use the new tag as the release tag
146134
- Copy the release notes from `NEWS` into the GitHub release notes; reformat
147135
from ASCIIdoc to Markdown and remove line wraps. Include all changes since
148136
the previous release (not just changes since the previous pre-release).
149-
- Attach the signature files from
150-
`build/dist/webauthn-server-attestation-X.Y.Z.jar.asc`
151-
and
152-
`build/dist/webauthn-server-core-X.Y.Z.jar.asc`.
153-
154137
- Note which JDK version was used to build the artifacts.
138+
139+
13. Check that the ["Reproducible binary"
140+
workflow](/Yubico/java-webauthn-server/actions/workflows/release-verify-signatures.yml)
141+
runs and succeeds.

0 commit comments

Comments
 (0)