-
-
Notifications
You must be signed in to change notification settings - Fork 81
74 lines (65 loc) · 2.14 KB
/
Copy pathbuild.yml
File metadata and controls
74 lines (65 loc) · 2.14 KB
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
name: "Test, build and release"
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
on:
workflow_dispatch:
inputs:
release:
type: boolean
default: false
description: Whether to make a release
pull_request:
push:
paths-ignore:
- "README.md"
- ".gitignore"
jobs:
build:
runs-on: macos-26
steps:
- uses: actions/checkout@v6
- name: VERSION file changed
id: version-file-changed
uses: tj-actions/changed-files@v47
with:
files: VERSION
- name: Should make release?
if: |
github.event_name == 'workflow_dispatch' && github.event.inputs.release ||
(github.ref == 'refs/heads/main' &&
github.event_name == 'push' &&
steps.version-file-changed.outputs.any_changed == 'true')
run: echo make_release=true >> "$GITHUB_ENV"
- name: Get version
if: env.make_release
run: echo VERSION="$(head VERSION)" >> "$GITHUB_ENV"
- name: Gradle Build and Test
run: |
./gradlew build --info --stacktrace
- name: Release (GitHub)
if: env.make_release
id: github_release
uses: softprops/action-gh-release@v3
with:
name: ${{ env.VERSION }}
tag_name: ${{ env.VERSION }}
- name: Prepare PGP Keyring file
if: env.make_release
env:
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
run: |
echo "${GPG_KEY_CONTENTS}" | base64 -d > signing-key.gpg
shell: bash
- name: Publish to Maven Central
if: env.make_release
run: |
./gradlew \
publishAllPublicationsToSonatypeRepository \
closeAndReleaseSonatypeStagingRepository \
--info --stacktrace
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}