-
Notifications
You must be signed in to change notification settings - Fork 4
173 lines (150 loc) · 6.1 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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Quarkiverse Release
on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Version to use when preparing a release. Ex 1.0.0, 1.0.1-RC1, 1.0.2-EA3"
required: true
default: "1.0.0"
sourceBranch:
description: "Which branch contains the previous release version."
default: "main"
concurrency:
group: "quarkiverse-release"
cancel-in-progress: false
defaults:
run:
shell: bash
permissions:
contents: write
packages: write
checks: write
jobs:
release:
runs-on: ubuntu-latest
name: release
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.sourceBranch }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 #v6.1.0
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_SECRET }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: 'maven'
server-id: github
gpg-passphrase: GPG_PASSPHRASE
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Pre-Release Check - Version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api --method GET /repos/${{github.repository}}/releases -f sort=updated -f direction=asc > releases.json
release_version_exists=$(jq -r --arg RELEASE_VERSION ${{ github.event.inputs.releaseVersion }} '.[].name|select(. == $RELEASE_VERSION)' releases.json)
if [[ ! -z "$release_version_exists" ]]; then
echo "Version ${{ github.event.inputs.releaseVersion }} has been previously released. Please change release version."
exit 1
else
echo "New version: ${{ github.event.inputs.releaseVersion }} going to be released!"
fi
- name: Add SSH Key for write access for commits
uses: kielabokkie/ssh-key-and-known-hosts-action@v1
with:
ssh-private-key: ${{ secrets.COMMIT_KEY }}
ssh-host: github.com
- name: Set Build Params
run: |
echo "SKIP_FLAGS_ALL_TESTS=-DskipTests=true" >> $GITHUB_ENV
if echo "${{github.event.inputs.releaseVersion}}" | grep -iP 'ea|rc'; then
NEXT_DEV_REVISION="\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}"
else
NEXT_DEV_REVISION="\${next-revision}"
fi
echo "Calculated Params"
echo "NEXT_DEV_REVISION=$NEXT_DEV_REVISION"
echo "NEXT_DEV_REVISION=$NEXT_DEV_REVISION" >> $GITHUB_ENV
- name: Release Version - Prepare
run: >-
mvn -B -U validate
versions:set-property
-Dproperty=revision
-DnewVersion="${{ github.event.inputs.releaseVersion }}" &&
mvn validate
versions:set-property
-Dproperty=changelist
-DnewVersion=""
- name: Update latest release version in docs
run: |
mvn -B -ntp -pl docs -am generate-resources -Denforcer.skip -Dformatter.skip -Dimpsort.skip
if ! git diff --quiet docs/modules/ROOT/pages/includes/attributes.adoc; then
git add docs/modules/ROOT/pages/includes/attributes.adoc
fi
- name: Verify Maven
run: mvn -B verify
- name: Publishing Test Results - Unit/Integration Tests Pre-Condition
if: always()
id: unit_integration_test_report_exists
uses: andstor/file-existence-action@v2
with:
files: "**/surefire-reports/**/TEST*.xml"
- name: Publishing Test Results - Unit/Integration Tests
uses: dorny/[email protected]
if: always() && steps.unit_integration_test_report_exists.outputs.files_exists == 'true'
with:
name: Test Results
path: "**/surefire-reports/**/TEST*.xml"
fail-on-error: 'false'
reporter: java-junit
only-summary: 'true'
- name: Configure Git author
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Release Version - Checkin
run: >-
mvn -B validate
scm:checkin
-DscmVersion=${{ github.event.inputs.sourceBranch }}
-DscmVersionType=branch
-Dmessage="[ci skip] prepare release ${{ github.event.inputs.releaseVersion }}" &&
mvn -B scm:tag -Dtag=${{ github.event.inputs.releaseVersion }}
- name: GitHub Packages - Deploy Artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_SECRET }}
run: |
mvn -B deploy -Dmaven.install.skip=true $SKIP_FLAGS_ALL_TESTS -Pgithub,publish
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v4
with:
servers: '[{ "id": "ossrh", "username": "${{ secrets.OSSRH_USER }}", "password": "${{ secrets.OSSRH_PASS }}" }]'
- name: Maven Central - Deploy Artifacts
env:
GPG_PASSPHRASE: ${{ secrets.GPG_SECRET }}
run: |
mvn -B deploy -Dmaven.install.skip=true $SKIP_FLAGS_ALL_TESTS -Possrh,publish
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: "${{ github.event.inputs.releaseVersion }}"
generateReleaseNotes: true
makeLatest: true
- name: Next Develoment Version - Prepare and Checkin
run: >-
mvn -B -U validate build-helper:parse-version versions:set-property
-Dproperty=revision
-DnewVersion='${{ env.NEXT_DEV_REVISION}}' &&
mvn validate
versions:set-property
-Dproperty=changelist
-DnewVersion="-SNAPSHOT" &&
mvn validate scm:checkin -B
-DscmVersion=${{ github.event.inputs.sourceBranch }}
-DscmVersionType=branch
-Dmessage="[ci skip] prepare for next development iteration"