Skip to content

Commit 28c41ec

Browse files
authored
Release automation (#844)
* Improve release workflow * Automate some of the tasks (build, sign, hash) * Fix environment variables and secrets * Publish snapshot on apache nexus * Revise release instructions
1 parent ade9d22 commit 28c41ec

File tree

12 files changed

+256
-81
lines changed

12 files changed

+256
-81
lines changed

.github/workflows/analyze.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818
- name: Set up Java 17
1919
uses: actions/setup-java@v3
2020
with:
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-latest
3030
steps:
3131
- name: Checkout code
32-
uses: actions/checkout@v3
32+
uses: actions/checkout@v4
3333
- name: Set up Java 17
3434
uses: actions/setup-java@v3
3535
with:

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818
- name: Set up Java 17
1919
uses: actions/setup-java@v3
2020
with:
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: macos-latest
3030
steps:
3131
- name: Checkout code
32-
uses: actions/checkout@v3
32+
uses: actions/checkout@v4
3333
- name: Set up Java 17
3434
uses: actions/setup-java@v3
3535
with:
@@ -44,7 +44,7 @@ jobs:
4444
runs-on: windows-latest
4545
steps:
4646
- name: Checkout code
47-
uses: actions/checkout@v3
47+
uses: actions/checkout@v4
4848
- name: Set up Java 17
4949
uses: actions/setup-java@v3
5050
with:

.github/workflows/candidate.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Publish candidate
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+'
7+
8+
jobs:
9+
publish-candidate:
10+
name: Publish candidate
11+
runs-on: ubuntu-latest
12+
steps:
13+
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Java 17
18+
uses: actions/setup-java@v3
19+
with:
20+
java-version: 17
21+
distribution: temurin
22+
cache: maven
23+
server-username: NEXUS_USER
24+
server-password: NEXUS_PW
25+
gpg-private-key: ${{ secrets.BAREMAPS_GPG_SECRET_KEY }}
26+
27+
- name: Extract variables
28+
id: variables
29+
shell: bash
30+
run: |
31+
echo "git_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
32+
echo "git_version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
33+
echo "mvn_version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT
34+
35+
- name: Build candidate
36+
shell: bash
37+
run: mvn install -DskipTests -Dmaven.javadoc.skip=true -B -V
38+
39+
- name: Set up GPG
40+
shell: bash
41+
run: |
42+
echo "${{ secrets.BAREMAPS_GPG_SECRET_KEY }}" | gpg --batch --import
43+
gpg --list-keys
44+
env:
45+
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
46+
47+
- name: Sign and hash candidate
48+
shell: bash
49+
run: |
50+
cd ./baremaps-cli/target
51+
mv apache-baremaps-${{ steps.variables.outputs.mvn_version }}-incubating-src.tar.gz apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz
52+
shasum -a 512 "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz" > "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz.sha512"
53+
gpg --no-tty --quiet --pinentry-mode loopback --default-key "${{ secrets.GPG_KEY_ID }}" --batch --yes --output "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz.asc" --detach-sign --armor "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz"
54+
mv apache-baremaps-${{ steps.variables.outputs.mvn_version }}-incubating-bin.tar.gz apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz
55+
shasum -a 512 "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz" > "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz.sha512"
56+
gpg --no-tty --quiet --pinentry-mode loopback --default-key "${{ secrets.GPG_KEY_ID }}" --batch --yes --output "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz.asc" --detach-sign --armor "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz"
57+
cd -
58+
59+
- name: Publish release candidate on GitHub
60+
shell: bash
61+
env:
62+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
run: |
64+
gh release create "${{ steps.variables.outputs.git_tag }}" --draft --prerelease --title "Apache Baremaps ${{ steps.variables.outputs.git_version }} (incubating)" --repo ${{ github.repository }} --generate-notes
65+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz
66+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz.sha512
67+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz.asc
68+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz
69+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz.sha512
70+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz.asc
71+
72+
- name: Publish release candidate on Apache SVN
73+
shell: bash
74+
run: |
75+
mkdir -p ${{ steps.variables.outputs.git_version }}
76+
cp ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-* ${{ steps.variables.outputs.git_version }}
77+
svn --username "${{ secrets.INCUBATOR_SVN_DEV_USERNAME }}" --password "${{ secrets.INCUBATOR_SVN_DEV_PASSWORD }}" import -m "Apache Baremaps ${{ steps.variables.outputs.git_version }} (incubating)" ${{ steps.variables.outputs.git_version }} https://dist.apache.org/repos/dist/dev/incubator/baremaps/${{ steps.variables.outputs.git_version }}
78+
rm -rf ${{ steps.variables.outputs.git_version }}

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
language: [ 'java', 'javascript' ]
24+
language: [ 'java' ]
2525
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
2626
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
2727

2828
steps:
2929
- name: Checkout repository
30-
uses: actions/checkout@v3
30+
uses: actions/checkout@v4
3131

3232
- name: Set up Java 17
3333
uses: actions/setup-java@v3

.github/workflows/deploy-snapshot.yml renamed to .github/workflows/snapshot.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy snapshot
1+
name: Publish candidate
22

33
on:
44
push:
@@ -21,19 +21,20 @@ jobs:
2121
java-version: 17
2222
distribution: temurin
2323
cache: maven
24-
server-id: apache.snapshots.https
2524
server-username: NEXUS_USER
2625
server-password: NEXUS_PW
2726
gpg-private-key: ${{ secrets.BAREMAPS_GPG_SECRET_KEY }}
2827

2928
- name: Set up GPG
29+
shell: bash
3030
run: |
3131
echo "${{ secrets.BAREMAPS_GPG_SECRET_KEY }}" | gpg --batch --import
3232
gpg --list-keys
3333
env:
3434
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
3535

36-
- name: Publish snapshots on Apache Nexus
36+
- name: Publish candidate snapshots on Apache Nexus
37+
shell: bash
3738
env:
3839
NEXUS_USER: ${{ secrets.NEXUS_USER }}
3940
NEXUS_PW: ${{ secrets.NEXUS_PW }}

0 commit comments

Comments
 (0)