-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (60 loc) · 2.35 KB
/
release.yml
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
name: Publish to the Maven Central Repository
on:
workflow_dispatch:
inputs:
version:
description: Version to be released
required: true
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.RELEASE_PERSONAL_ACCESS_TOKEN }}
- name: Validate ${{ github.event.inputs.version }} release exists
uses: actions/github-script@v2
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const response = await github.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo
});
if (!response) {
throw new Error(`There are no available releases`);
}
for (const release of response.data) {
if (release.name === "${{ github.event.inputs.version }}") {
return
}
}
throw new Error(`Release ${{ github.event.inputs.version }} is not available`);
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Update version
run: |
./mvnw --batch-mode --no-transfer-progress versions:set -DnewVersion=${{ github.event.inputs.version }} versions:commit
git config user.name "jenkins"
git config user.email "[email protected]"
git commit -m "Release ${{ github.event.inputs.version }}" -a
git push
- name: Publish to the Maven Central Repository
run: ./mvnw --batch-mode --no-transfer-progress -Dgib.disable=true -Ddocker.cleanup.skip=true -P ossrh -DskipTests deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Publish release on GitHub
uses: test-room-7/action-publish-release-drafts@v0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
tag-name: ${{ github.event.inputs.version }}