Skip to content

Commit 767b079

Browse files
committed
Add a github workflow for pre-releases
1 parent 63d0574 commit 767b079

File tree

2 files changed

+68
-3
lines changed

2 files changed

+68
-3
lines changed

.github/workflows/pre-release.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+-alpha[0-9]+'
7+
- 'v[0-9]+.[0-9]+.[0-9]+-beta[0-9]+'
8+
- 'v[0-9]+.[0-9]+.[0-9]+-test[0-9]+'
9+
jobs:
10+
publish-pre-release:
11+
name: Publish pre-release
12+
runs-on: ubuntu-latest
13+
steps:
14+
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Java 17
19+
uses: actions/setup-java@v3
20+
with:
21+
java-version: 17
22+
distribution: temurin
23+
cache: maven
24+
server-username: NEXUS_USER
25+
server-password: NEXUS_PW
26+
gpg-private-key: ${{ secrets.BAREMAPS_GPG_SECRET_KEY }}
27+
28+
- name: Extract variables
29+
id: variables
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 pre-release
36+
run: mvn install -DskipTests -Dmaven.javadoc.skip=true -B -V
37+
38+
- name: Set up GPG
39+
run: |
40+
echo "${{ secrets.BAREMAPS_GPG_SECRET_KEY }}" | gpg --batch --import
41+
gpg --list-keys
42+
env:
43+
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
44+
45+
- name: Sign and hash pre-release
46+
run: |
47+
cd ./baremaps-cli/target
48+
mv apache-baremaps-${{ steps.variables.outputs.mvn_version }}-incubating-src.tar.gz apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz
49+
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"
50+
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"
51+
mv apache-baremaps-${{ steps.variables.outputs.mvn_version }}-incubating-bin.tar.gz apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz
52+
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"
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-bin.tar.gz.asc" --detach-sign --armor "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz"
54+
cd -
55+
56+
- name: Publish pre-release on GitHub
57+
env:
58+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
run: |
60+
gh release create "${{ steps.variables.outputs.git_tag }}" --draft --prerelease --title "Apache Baremaps ${{ steps.variables.outputs.git_version }} (incubating)" --repo ${{ github.repository }} --generate-notes
61+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz
62+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz.sha512
63+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz.asc
64+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz
65+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz.sha512
66+
gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz.asc

.github/workflows/release.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
tags:
66
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+'
77

8-
jobs:
98
publish-candidate:
109
name: Publish candidate
1110
runs-on: ubuntu-latest
@@ -31,7 +30,7 @@ jobs:
3130
echo "git_version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
3231
echo "mvn_version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT
3332
34-
- name: Build candidate
33+
- name: Build release candidate
3534
run: mvn install -DskipTests -Dmaven.javadoc.skip=true -B -V
3635

3736
- name: Set up GPG
@@ -41,7 +40,7 @@ jobs:
4140
env:
4241
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
4342

44-
- name: Sign and hash candidate
43+
- name: Sign and hash release candidate
4544
run: |
4645
cd ./baremaps-cli/target
4746
mv apache-baremaps-${{ steps.variables.outputs.mvn_version }}-incubating-src.tar.gz apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz

0 commit comments

Comments
 (0)