-
Notifications
You must be signed in to change notification settings - Fork 50
73 lines (60 loc) · 2.81 KB
/
build.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
name: Pipeline
on: [push, pull_request]
jobs:
build:
name: "Build, Test and Publish"
runs-on: ubuntu-latest
env:
TERM: xterm-256color
GPG_KEY_ID: 6D76AD03 # Run `gpg -K` to get this, take last eight characters
OSSRH_USERNAME: kaml-github-actions
GRADLE_OPTS: "-Dorg.gradle.internal.launcher.welcomeMessageEnabled=false"
permissions:
contents: write # Required to be able to publish releases, see https://docs.github.com/en/rest/reference/permissions-required-for-github-apps#permission-on-contents
steps:
- name: Check out code
uses: actions/checkout@v4.1.4
with:
fetch-depth: 0
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v3.3.2
- name: Set up JDK
uses: actions/setup-java@v4.2.1
with:
java-version: 17
distribution: temurin
- name: Setup Gradle
uses: gradle/gradle-build-action@v3.3.2
- name: Build
run: ./gradlew assemble
- name: Check
run: ./gradlew check
- name: Assemble release
run: ./gradlew assembleRelease
env:
GPG_KEY_RING: ${{ secrets.GPG_KEY_RING }} # Run `gpg --export-secret-keys "<key user name goes here>" | base64` to get this
GPG_KEY_PASSPHRASE: ${{ secrets.GPG_KEY_PASSPHRASE }}
if: github.repository == 'charleskorn/kaml' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push'
- name: Publish snapshot
run: ./gradlew publishSnapshot
env:
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_KEY_RING: ${{ secrets.GPG_KEY_RING }} # Run `gpg --export-secret-keys "<key user name goes here>" | base64` to get this
GPG_KEY_PASSPHRASE: ${{ secrets.GPG_KEY_PASSPHRASE }}
if: github.repository == 'charleskorn/kaml' && github.ref == 'refs/heads/main' && github.event_name == 'push'
- name: Publish release
run: ./gradlew publishRelease
env:
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_KEY_RING: ${{ secrets.GPG_KEY_RING }} # Run `gpg --export-secret-keys "<key user name goes here>" | base64` to get this
GPG_KEY_PASSPHRASE: ${{ secrets.GPG_KEY_PASSPHRASE }}
if: github.repository == 'charleskorn/kaml' && startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
- name: Create GitHub release
uses: softprops/action-gh-release@v2.0.4
with:
files: build/release/*
fail_on_unmatched_files: true
draft: true # Update draft release with matching tag, if there is one.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.repository == 'charleskorn/kaml' && startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'