-
Notifications
You must be signed in to change notification settings - Fork 0
196 lines (170 loc) · 6.15 KB
/
push_branch-main_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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: Backend - Main - Release on push
on:
push:
branches:
- main
- master
- next
- next-major
- beta
- alpha
- '[0-9]+.[0-9]+.x'
- '[0-9]+.x'
env:
java-version: 21
distribution: graalvm
node-js-version: 20.x
author-name: Marc Scheib
author-email: marc.scheib@cycrilabs.com
publish-artifacts: false
build-native-image: false
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout [${{ github.head_ref || github.ref_name }}]
uses: actions/checkout@v4
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
distribution: ${{ env.distribution }}
java-version: ${{ env.java-version }}
cache: 'maven'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Adapt maven settings
uses: s4u/maven-settings-action@v2
with:
servers: '[{"id": "github", "username": "dummy", "password": "${{ secrets.GITHUB_TOKEN }}"}]'
githubServer: false
- name: Test
run: mvn -B verify -Pgithub
release:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout [${{ github.head_ref || github.ref_name }}]
uses: actions/checkout@v4
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
distribution: ${{ env.distribution }}
java-version: ${{ env.java-version }}
cache: 'maven'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Adapt maven settings
uses: s4u/maven-settings-action@v2
with:
servers: '[{"id": "github", "username": "dummy", "password": "${{ secrets.GITHUB_TOKEN }}"}]'
githubServer: false
- name: Setup Node.js [${{ env.node-js-version }}]
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-js-version }}
- name: Release
run: npm exec --package=@semantic-release/changelog --package=@semantic-release/git --package=@semantic-release/exec --yes -- semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: ${{ env.author-name }}
GIT_AUTHOR_EMAIL: ${{ env.author-email }}
build-container-image:
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout [${{ github.head_ref || github.ref_name }}]
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
distribution: ${{ env.distribution }}
java-version: ${{ env.java-version }}
cache: 'maven'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Adapt maven settings
uses: s4u/maven-settings-action@v2
with:
servers: '[{"id": "github", "username": "dummy", "password": "${{ secrets.GITHUB_TOKEN }}"}]'
githubServer: false
- name: Deploy project & image
if: ${{ env.build-native-image == true }}
run: >
mvn -B package -Pgithub -DskipTests
-Dquarkus.container-image.build=true
-Dquarkus.native.container-build=true -Dnative
-Dquarkus.container-image.push=true
-Dquarkus.container-image.registry=ghcr.io
-Dquarkus.container-image.username=${{ github.actor }}
-Dquarkus.container-image.password=${{ secrets.GITHUB_TOKEN }}
- name: Deploy project & image
if: ${{ env.build-native-image == false }}
run: >
mvn -B package -Pgithub -DskipTests
-Dquarkus.container-image.build=true
-Dquarkus.container-image.push=true
-Dquarkus.container-image.registry=ghcr.io
-Dquarkus.container-image.username=${{ github.actor }}
-Dquarkus.container-image.password=${{ secrets.GITHUB_TOKEN }}
build-artifacts:
needs: release
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout [${{ github.head_ref || github.ref_name }}]
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
distribution: ${{ env.distribution }}
java-version: ${{ env.java-version }}
cache: 'maven'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Adapt maven settings
uses: s4u/maven-settings-action@v2
with:
servers: '[{"id": "github", "username": "dummy", "password": "${{ secrets.GITHUB_TOKEN }}"}]'
githubServer: false
- name: Build artifacts
if: ${{ env.publish-artifacts == true }}
run: mvn -B package -DskipTests -P github,dist,native # space between -P and dist,native is important for Windows PowerShell build
- name: Upload artifacts
uses: CycriLabs/publish-assets@v1
if: ${{ env.publish-artifacts == true }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_dir: 'target/distributions'
release_tag: 'latest'
next-dev-version:
needs: [build-container-image, build-artifacts]
runs-on: ubuntu-latest
steps:
- name: Checkout [${{ github.head_ref || github.ref_name }}]
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
distribution: ${{ env.distribution }}
java-version: ${{ env.java-version }}
cache: 'maven'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Adapt maven settings
uses: s4u/maven-settings-action@v2
with:
servers: '[{"id": "github", "username": "dummy", "password": "${{ secrets.GITHUB_TOKEN }}"}]'
githubServer: false
- name: Set next snapshot
run: mvn versions:set -Pgithub -DnextSnapshot=true && mvn -Pgithub versions:commit
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
author_name: ${{ env.author-name }}
author_email: ${{ env.author-email }}
message: 'chore: set next development version [skip ci]'
add: '.'