-
Notifications
You must be signed in to change notification settings - Fork 167
60 lines (50 loc) · 1.91 KB
/
release_to_github.yml
File metadata and controls
60 lines (50 loc) · 1.91 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
name: Release to GitHub
on:
workflow_dispatch:
jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: main
fetch-depth: 0
- name: Cache Maven
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Setup Java JDK
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version: '11'
distribution: 'microsoft'
- name: Version
id: version
run: |
release_tag=$( ./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout )
release_tag=${release_tag%-*}
echo "release_tag=gctoolkit-${release_tag}" >> "$GITHUB_ENV"
previous_tag=$( git tag --sort=-taggerdate --list 'gctoolkit-*' | head -n1 )
echo "previous_tag=${previous_tag}" >> "$GITHUB_ENV"
- name: Release Prepare
run: |
./mvnw -B -Prelease release:clean release:prepare \
-Drepository.url=https://${{ github.actor }}:${{ secrets.RELEASE_TOKEN }}@github.com/${{ github.repository }}.git
env:
GIT_AUTHOR_NAME: 'Git'
GIT_AUTHOR_EMAIL: 'noreply@github.com'
GIT_COMMITTER_NAME: 'Git'
GIT_COMMITTER_EMAIL: 'noreply@github.com'
- name: Release to GitHub
run: |
git checkout "$release_tag"
./mvnw -B -pl :gctoolkit -Pjreleaser jreleaser:release \
-Djreleaser.previous.tag.name="$previous_tag" \
-Djreleaser.tag.name="$release_tag"
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}