-
Notifications
You must be signed in to change notification settings - Fork 2
145 lines (123 loc) · 4.05 KB
/
master.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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: release
on:
push:
branches:
- 'master'
paths-ignore:
- '.github/dependabot.yml'
- '*.md'
jobs:
maven-release:
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Install Java and Maven
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'zulu'
cache: 'maven'
- name: Unsnapshot version
run: mvn --batch-mode versions:set -DremoveSnapshot
- id: get-version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: upload release pom
uses: actions/upload-artifact@v3
with:
name: pom
path: pom.xml
if-no-files-found: error
- name: Set up Apache Maven Central
uses: actions/setup-java@v3
with: # running setup-java again overwrites the settings.xml
java-version: '11'
distribution: 'zulu'
cache: 'maven'
server-id: ossrh
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.gpg_private_key }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Publish to Apache Maven Central
run: mvn --batch-mode clean deploy -P release
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.gpg_passphrase }}
- name: upload packages
uses: actions/upload-artifact@v3
with:
name: target
path: target/hsac-fitnesse-pdf-*.jar
github-release:
needs: [maven-release]
runs-on: ubuntu-22.04
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: download pom
uses: actions/download-artifact@v3
with:
name: pom
- name: download packages
uses: actions/download-artifact@v3
with:
name: target
path: target
- name: Create changelog text
id: changelog
uses: loopwerk/tag-changelog@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
exclude_types: other,doc,chore
- name: Configure git
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
- name: Commit pom.xml without -SNAPSHOT
run: |
git add pom.xml
git commit -m "Prepare for release"
git push origin master
- name: Create Release
id: createRelease
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.maven-release.outputs.version }}
body: ${{ steps.changelog.outputs.changes }}
draft: false
prerelease: false
files: |
target/hsac-fitnesse-pdf-*.jar
update-version:
needs: [github-release]
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Java and Maven
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'zulu'
cache: 'maven'
- name: Configure git
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
- name: Pull changes from github-release job
run: |
git pull origin
- name: Update version
run: |
mvn --batch-mode release:update-versions -DautoVersionSubmodules=true
- name: Push pom.xml with next -SNAPSHOT version to repository
run: |
git add pom.xml
git commit -m "Prepare for next developments"
git push origin master