-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (118 loc) · 3.84 KB
/
ci.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
# This is a basic workflow to help you get started with Actions
name: CI
'on':
push:
jobs:
test-hello:
name: Test hello world on jvm
strategy:
matrix:
os:
- ubuntu-latest
#- windows-latest
#- macos-latest
java-version:
- 11
#- 18
jdk-distribution:
- adopt-hotspot
#- adopt-openj9
runs-on: ${{ matrix.os }}
steps:
- name: JDK ${{ matrix.jdk-distribution }} v${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.jdk-distribution }}
java-version: ${{ matrix.java-version }}
- name: Checkout code
uses: actions/checkout@v4
with:
submodule: recursive
fetch-dept: 0
- name:
run: ./gradlew test
test-release:
name: Test Release
runs-on: ubuntu-latest
if: >-
!github.event.repository.fork
&& (
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name == github.repository
)
concurrency:
group: test-release-${{ github.event.number || github.ref }}
cancel-in-progress: true
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: adopt
server-username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
server-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
- name: Deploy
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
run: ./gradlew uploadAllPublicationsToMavenCentralNexus closeStagingRepositoryOnMavenCentral
release:
needs:
- test-hello
- test-release
runs-on: ubuntu-latest
if: >-
!github.event.repository.fork
&& (
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name == github.repository
)
concurrency:
# One release job at a time per branch - pr are usually on separate branches...
# And also semantic release is configured to release on from main branch
group: release-${{ github.event.number || github.ref }}
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: adopt
server-username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
server-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
- name: Deploy
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
npm install
npx semantic-release
success:
runs-on: ubuntu-latest
needs:
- test-hello
- test-release
- release
if: >-
always() && (
contains(join(needs.*.result, ','), 'failure')
|| !contains(join(needs.*.result, ','), 'cancelled')
)
steps:
- name: Verify that there were no failures
run: ${{ !contains(join(needs.*.result, ','), 'failure') }}