Skip to content

Commit 3dbe1b7

Browse files
committed
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 3dbe1b7

File tree

12 files changed

+250
-83
lines changed

12 files changed

+250
-83
lines changed

.github/workflows/analyze.yml

+2-2
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

+3-3
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/codeql.yml

+2-2
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/release.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Release
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+
run: |
30+
echo "git_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
31+
echo "git_version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
32+
echo "mvn_version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT
33+
34+
- name: Build candidate
35+
run: mvn install -DskipTests -Dmaven.javadoc.skip=true -B -V
36+
37+
- name: Set up GPG
38+
run: |
39+
echo "${{ secrets.BAREMAPS_GPG_SECRET_KEY }}" | gpg --batch --import
40+
gpg --list-keys
41+
env:
42+
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
43+
44+
- name: Sign and hash candidate
45+
run: |
46+
cd ./baremaps-cli/target
47+
mv apache-baremaps-${{ steps.variables.outputs.mvn_version }}-incubating-src.tar.gz apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz
48+
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"
49+
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"
50+
mv apache-baremaps-${{ steps.variables.outputs.mvn_version }}-incubating-bin.tar.gz apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz
51+
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"
52+
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"
53+
cd -
54+
55+
- name: Publish release candidate on GitHub
56+
env:
57+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
run: |
59+
gh release create "${{ steps.variables.outputs.git_tag }}" --draft --prerelease --title "Apache Baremaps ${{ steps.variables.outputs.git_version }} (incubating)" --repo ${{ github.repository }} --generate-notes
60+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz
61+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz.sha512
62+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz.asc
63+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz
64+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz.sha512
65+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz.asc
66+
67+
- name: Publish release candidate on Apache SVN
68+
run: |
69+
mkdir -p ${{ steps.variables.outputs.git_version }}
70+
cp ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-* ${{ steps.variables.outputs.git_version }}
71+
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 }}
72+
rm -rf ${{ steps.variables.outputs.git_version }}

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

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
name: Deploy snapshot
1+
name: Nexus
22

33
on:
44
push:
55
branches:
66
- main
77

88
jobs:
9-
deploy-snapshot:
10-
name: Deploy snapshot
9+
publish-snapshot:
10+
name: Publish snapshot
1111
runs-on: ubuntu-latest
1212
if: "!startsWith(github.ref, 'refs/tags/v')"
1313
steps:
@@ -21,7 +21,6 @@ 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 }}
@@ -33,7 +32,7 @@ jobs:
3332
env:
3433
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
3534

36-
- name: Publish snapshots on Apache Nexus
35+
- name: Publish snapshot artifacts on Apache Nexus
3736
env:
3837
NEXUS_USER: ${{ secrets.NEXUS_USER }}
3938
NEXUS_PW: ${{ secrets.NEXUS_PW }}

0 commit comments

Comments
 (0)