Skip to content

Commit 17aa938

Browse files
Merge pull request #20 from briancorbinxyz/main
Add the gradle publishing workflow
2 parents c6243bd + ebf2397 commit 17aa938

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

.github/workflows/gradle-publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
6+
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
7+
8+
name: Gradle Package
9+
10+
on:
11+
release:
12+
types: [created]
13+
14+
jobs:
15+
build:
16+
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Set up JDK 22
25+
uses: actions/setup-java@v4
26+
with:
27+
java-version: '22'
28+
distribution: 'temurin'
29+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
30+
settings-path: ${{ github.workspace }} # location for the settings.xml file
31+
32+
- name: Setup Gradle
33+
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
34+
35+
- name: Build with Gradle
36+
run: ./gradlew build
37+
38+
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
39+
# the publishing section of your build.gradle
40+
- name: Publish to GitHub Packages
41+
run: ./gradlew publish
42+
env:
43+
USERNAME: ${{ github.actor }}
44+
TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/gradle.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
- name: Set up JDK
6060
uses: actions/setup-java@v4
6161
with:
62+
# https://github.com/actions/setup-java?tab=readme-ov-file#supported-distributions
6263
java-version: '22'
6364
distribution: 'temurin'
6465

0 commit comments

Comments
 (0)