Skip to content

Commit 2b9796d

Browse files
committed
Setup github workflows
1 parent 5d156f0 commit 2b9796d

File tree

3 files changed

+186
-0
lines changed

3 files changed

+186
-0
lines changed

.github/release-drafter.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name-template: $RESOLVED_VERSION
2+
tag-template: v$RESOLVED_VERSION
3+
categories:
4+
- title: ✨ Features
5+
labels:
6+
- "type: enhancement"
7+
- "type: new feature"
8+
- "type: major"
9+
- title: 🐛 Bug Fixes/Improvements
10+
labels:
11+
- "type: improvement"
12+
- "type: bug"
13+
- "type: minor"
14+
- title: 🛠 Dependency upgrades
15+
labels:
16+
- "type: dependency upgrade"
17+
- "dependencies"
18+
- title: ⚙️ Build/CI
19+
labels:
20+
- "type: ci"
21+
- "type: build"
22+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
23+
version-resolver:
24+
major:
25+
labels:
26+
- 'type: major'
27+
minor:
28+
labels:
29+
- 'type: minor'
30+
patch:
31+
labels:
32+
- 'type: patch'
33+
default: patch
34+
template: |
35+
## What's Changed
36+
37+
$CHANGES
38+
39+
## Contributors
40+
41+
$CONTRIBUTORS

.github/workflows/gradle.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Grace CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
jobs:
11+
build:
12+
permissions:
13+
contents: read # to fetch code (actions/checkout)
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
java: ['17']
18+
env:
19+
WORKSPACE: ${{ github.workspace }}
20+
steps:
21+
- name: Checkout repository
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
uses: actions/checkout@v4
25+
with:
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
- name: Set up JDK
28+
uses: actions/setup-java@v4
29+
with:
30+
distribution: 'adopt'
31+
java-version: ${{ matrix.java }}
32+
- name: Run Build
33+
id: build
34+
uses: gradle/actions/setup-gradle@v3
35+
with:
36+
arguments: build -x test
37+
publish:
38+
if: github.event_name == 'push'
39+
needs: ["build"]
40+
permissions:
41+
contents: read # to fetch code (actions/checkout)
42+
checks: write
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Checkout repository
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
uses: actions/checkout@v4
49+
with:
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
- name: Set up JDK 17
52+
uses: actions/setup-java@v4
53+
with:
54+
distribution: 'adopt'
55+
java-version: 17
56+
- name: Generate secring file
57+
env:
58+
SECRING_FILE: ${{ secrets.SECRING_FILE }}
59+
run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg
60+
- name: Publish to Sonatype OSSRH
61+
id: publish
62+
uses: gradle/actions/setup-gradle@v3
63+
env:
64+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
65+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
66+
SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }}
67+
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
68+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
69+
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
70+
SECRING_FILE: ${{ secrets.SECRING_FILE }}
71+
with:
72+
arguments: -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg :plugin:publishToSonatype closeAndReleaseSonatypeStagingRepository

.github/workflows/release.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Grace Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
create_draft_release:
13+
runs-on: ubuntu-latest
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
steps:
17+
- name: Create draft release
18+
run: |
19+
gh release create \
20+
--repo ${{ github.repository }} \
21+
--title ${{ github.ref_name }} \
22+
--notes '' \
23+
--draft \
24+
${{ github.ref_name }}
25+
release_and_publish:
26+
needs: create_draft_release
27+
runs-on: ubuntu-latest
28+
strategy:
29+
matrix:
30+
java: ['17']
31+
env:
32+
GIT_USER_NAME: rainboyan
33+
GIT_USER_EMAIL: [email protected]
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
with:
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
- uses: gradle/actions/wrapper-validation@v3
40+
- name: Set up JDK
41+
uses: actions/setup-java@v4
42+
with:
43+
distribution: 'adopt'
44+
java-version: ${{ matrix.java }}
45+
- name: Extract Target Branch
46+
id: extract_branch
47+
run: |
48+
echo "Determining Target Branch"
49+
TARGET_BRANCH=`cat $GITHUB_EVENT_PATH | jq '.release.target_commitish' | sed -e 's/^"\(.*\)"$/\1/g'`
50+
echo $TARGET_BRANCH
51+
echo ::set-output name=value::${TARGET_BRANCH}
52+
- name: Set the current release version
53+
id: release_version
54+
run: echo "release_version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT
55+
- name: Generate secring file
56+
id: secring
57+
env:
58+
SECRING_FILE: ${{ secrets.SECRING_FILE }}
59+
run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg
60+
- name: Publish to Sonatype OSSRH
61+
id: publish
62+
if: steps.secring.outcome == 'success'
63+
uses: gradle/actions/setup-gradle@v3
64+
env:
65+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
66+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
67+
SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }}
68+
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
69+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
70+
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
71+
SECRING_FILE: ${{ secrets.SECRING_FILE }}
72+
with:
73+
arguments: -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg :plugin:publishToSonatype closeAndReleaseSonatypeStagingRepository

0 commit comments

Comments
 (0)