-
Notifications
You must be signed in to change notification settings - Fork 2
167 lines (143 loc) · 6.14 KB
/
release-pipeline.yaml
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
name: RET release pipeline
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true
next:
description: 'Next version to release'
required: true
env:
JAVA_VERSION: '21'
JAVA_DISTRO: 'zulu'
jobs:
# Set versions
prepare:
runs-on: ubuntu-latest
steps:
- name: Retrieve tag exists flag
uses: mukunku/[email protected]
id: checkTag
with:
tag: ${{ github.event.inputs.version }}
- uses: actions/checkout@v4
if: steps.checkTag.outputs.exists == 'false'
with:
persist-credentials: false
fetch-depth: 0
- name: 'Set up Java'
if: steps.checkTag.outputs.exists == 'false'
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
- name: 'Configure Git user'
if: steps.checkTag.outputs.exists == 'false'
run: |
git config --global user.email "[email protected]"
git config --global user.name "Skunk Works Rabot"
- name: 'Prepare release'
if: steps.checkTag.outputs.exists == 'false'
run: |
RELEASE_VERSION=${{ github.event.inputs.version }}
NEXT_VERSION=${{ github.event.inputs.next }}
mvn -B -ntp --file pom.xml release:prepare -B -Dusername=skunkworks-rabot -Dpassword=${{ secrets.SKUNKWORKS_RABOT_PAT}} -Dtag=$RELEASE_VERSION -DreleaseVersion=$RELEASE_VERSION -DdevelopmentVersion="${NEXT_VERSION}-SNAPSHOT"
# Build RET CLI executable per runner
cli:
needs: [ prepare ]
name: 'Build RET CLI with Graal on ${{ matrix.os }}'
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macOS-latest, macos-14 ]
runs-on: ${{ matrix.os }}
steps:
- name: 'Check out repository'
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.version }}
fetch-depth: 0
- name: 'Set up Graal'
uses: graalvm/setup-graalvm@v1
with:
distribution: 'graalvm'
java-version: ${{ env.JAVA_VERSION }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Cache Maven packages'
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: 'Build Native Image'
run: mvn -B -ntp --file pom.xml -Pnative package
- name: 'Create distribution'
run: mvn -B -ntp --file pom.xml -Pdist package -DskipTests
- name: 'Upload build artifact'
uses: actions/upload-artifact@v3
with:
name: artifacts-cli
path: |
ret-cli/target/distributions/*.zip
ret-cli/target/distributions/*.tar.gz
# Package RET Plugin for maven central
plugin:
needs: [ prepare ]
name: 'Package RET Plugin for maven central'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.version }}
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
- name: Package artifact
run: |
mvn -B --file pom.xml -Ppublication
- name: 'Upload build artifact'
uses: actions/upload-artifact@v3
with:
name: artifacts-plugin
path: |
target/staging-deploy
# Collect all release candidates and release
release:
needs: [ cli, plugin ]
runs-on: ubuntu-latest
steps:
- name: 'Check out repository'
uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, pushing refs to dest repo fails
- name: 'Checkout tag'
run: |
git fetch --all
git checkout --progress --force refs/tags/${{ github.event.inputs.version }}
- name: 'Download all build artifacts'
uses: actions/download-artifact@v3
- name: 'Set up Java'
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
- name: 'Cache Maven packages'
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: 'Release with JReleaser'
env:
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
JRELEASER_NEXUS2_PASSWORD: ${{ secrets.JRELEASER_NEXUS2_PASSWORD }}
JRELEASER_NEXUS2_USERNAME: ${{ secrets.JRELEASER_NEXUS2_USERNAME }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.SKUNKWORKS_RABOT_PAT }}
run: mvn -N -B -ntp --file pom.xml -DartifactsDir=artifacts-cli jreleaser:full-release