-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (143 loc) · 5.16 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: CI
on:
pull_request:
push:
branches-ignore:
- 'dependabot/**'
workflow_dispatch:
inputs:
perform_release:
description: 'Perform release'
default: false
type: boolean
bump:
description: 'Bump type'
required: false
default: 'next'
type: choice
options:
- 'next'
- 'major'
- 'minor'
- 'patch'
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
fail-fast: false
name: Test ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Install libraries for Linux/Mac
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
run: brew install libarchive
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '22'
- name: Gradle build
uses: gradle/actions/setup-gradle@v3
env:
LD_LIBRARY_PATH: /home/linuxbrew/.linuxbrew/lib
JAVA_LIBRARY_PATH: /usr/local/opt/libarchive/lib
with:
arguments: build
gradle-home-cache-includes: |
caches
notifications
jdks
- name: Upload Unit Test Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.os }}
path: '**/build/reports/tests/'
version:
runs-on: macos-latest
if: github.repository_owner == 'gotson' && github.ref == 'refs/heads/main'
outputs:
version_current: ${{ steps.versions.outputs.version_current }}
version_next: ${{ steps.versions.outputs.version_next }}
should_release: ${{ steps.versions.outputs.should_release }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Install svu
run: brew install caarlos0/tap/svu
- name: Compute next version for release
if: inputs.perform_release
run: |
echo "VERSION_NEXT=`svu --pattern="v[0-9]*" --strip-prefix ${{ inputs.bump }}`" | tee -a $GITHUB_ENV
echo "VERSION_NEXT_SUFFIX=`svu --pattern="v[0-9]*" --strip-prefix ${{ inputs.bump }}`" | tee -a $GITHUB_ENV
- name: Compute next version for snapshot
if: inputs.perform_release != true
run: |
echo "VERSION_NEXT=`svu --pattern="v[0-9]*" --strip-prefix ${{ inputs.bump }}`" | tee -a $GITHUB_ENV
echo "VERSION_NEXT_SUFFIX=`svu --pattern="v[0-9]*" --strip-prefix ${{ inputs.bump }}`-SNAPSHOT" | tee -a $GITHUB_ENV
- name: Set Versions
id: versions
run: |
echo "version_current=`svu --pattern="v[0-9]*" --strip-prefix current`" >> $GITHUB_OUTPUT
echo "version_next=${{ env.VERSION_NEXT_SUFFIX }}" >> $GITHUB_OUTPUT
[[ `svu --pattern="v[0-9]*" --strip-prefix current` != ${{ env.VERSION_NEXT }} ]] && echo "should_release=true" >> $GITHUB_OUTPUT || echo
release:
needs: [ version, test ]
runs-on: ubuntu-latest
if: needs.version.outputs.should_release
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Display versions
run: |
echo "Current version: ${{ needs.version.outputs.version_current }}, should release: ${{ needs.version.outputs.version_next }}"
- name: Update version in gradle.properties
run: echo "version=${{ needs.version.outputs.version_next }}" > gradle.properties
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '22'
- name: Nexus publish
uses: gradle/actions/setup-gradle@v3
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.MAVENCENTRAL_USER }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.MAVENCENTRAL_PASSWORD }}
with:
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
- name: Release commit and push
uses: EndBug/add-and-commit@v9
if: inputs.perform_release
with:
message: 'chore(release): ${{ needs.version.outputs.version_next }} [skip ci]'
default_author: github_actions
- name: JReleaser full release
uses: gradle/actions/setup-gradle@v3
if: inputs.perform_release
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
arguments: jreleaserFullRelease
- name: JReleaser Release output
if: always() && inputs.perform_release
uses: actions/upload-artifact@v4
with:
name: jreleaser-release
path: |
build/jreleaser/trace.log
build/jreleaser/output.properties