-
Notifications
You must be signed in to change notification settings - Fork 6
74 lines (62 loc) · 2.26 KB
/
Copy pathrelease.yml
File metadata and controls
74 lines (62 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Release
on:
pull_request:
types: [closed]
branches:
- main
jobs:
release:
if: github.event.pull_request.merged == true # only run if PR was merged
runs-on: ubuntu-latest
permissions:
contents: write # needed for release + deleting branches
pages: write # needed to publish to GitHub Pages
id-token: write # required for GitHub Pages deployment
packages: write # needed for Maven Central deploy
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
cache: maven
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Import GPG key
run: |
mkdir -p ~/.gnupg
chmod 700 ~/.gnupg
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Deploy to Maven Central (signed)
run: mvn -B clean deploy -Pcentral -Dgpg.executable=gpg
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Build fat jar
# Tests already ran as part of the deploy step above; skip them here
# to avoid paying for the full suite twice in the same job.
run: mvn -B clean package -Pall -DskipTests
- name: Get project version
id: get-version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Detected version: $VERSION"
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ env.VERSION }}
name: v${{ env.VERSION }}
body: ${{ github.event.pull_request.body || format('Automated release of version {0}', env.VERSION) }}
files: |
target/*.jar
- name: Delete changeset branch
run: |
echo "Deleting branch 'changeset'"
git push origin --delete changeset || true