-
Notifications
You must be signed in to change notification settings - Fork 10
97 lines (84 loc) · 2.9 KB
/
deploy.yml
File metadata and controls
97 lines (84 loc) · 2.9 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Release New Version
on:
workflow_dispatch:
inputs:
dry-run:
description: "Run the steps without deploying anything"
default: false
type: boolean
skip-tests:
description: "Skip unit and integration tests"
default: false
type: boolean
version:
description: "Override deployment version"
default: ""
type: string
jobs:
release:
name: Release
environment:
name: maven-central
url: https://repo1.maven.org/maven2/io/github/ascopes/jct/java-compiler-testing/
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Initialize Java
uses: actions/setup-java@v5
with:
distribution: zulu
java-version: 25
server-id: central
server-username: CENTRAL_USERNAME
server-password: CENTRAL_TOKEN
gpg-passphrase: GPG_PASSPHRASE
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Configure Git
run: |-
git config user.name '${{ github.actor }}'
git config user.email '${{ github.actor }}@users.noreply.github.com'
- name: Create Maven Central Release
shell: bash
run: |-
if [[ '${{ inputs.version }}' == "" ]]; then
release_version="$(./mvnw -B help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT//g')"
else
release_version='${{ inputs.version }}'
fi
echo "release_version=${release_version}" >> "${GITHUB_ENV}"
./mvnw -B -e \
-Preleases \
-DdryRun='${{ inputs.dry-run }}' \
-Dinvoker.skip='${{ inputs.skip-tests }}' \
-Dpassword='${{ secrets.GITHUB_TOKEN }}' \
-DreleaseVersion="${release_version}" \
-DsignTag=false \
-DskipTests='${{ inputs.skip-tests }}' \
-Dtag="v${release_version}" \
clean verify release:prepare release:perform
env:
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Revert Maven Central Release
if: ${{ failure() }}
run: |-
./mvnw -B -e \
-Dpassword='${{ secrets.GITHUB_TOKEN }}' \
-DreleaseVersion="${release_version}" \
-Dtag="v${release_version}" \
release:rollback
- name: Create GitHub Release
if: ${{ ! inputs.dry-run }}
uses: ncipollo/release-action@v1
with:
tag: v${{ env.release_version }}
name: v${{ env.release_version }}
generateReleaseNotes: false
token: ${{ secrets.GITHUB_TOKEN }}