chore: Add the ability to publish to Github packages

Signed-off-by: Avior <github@avior.me>
This commit is contained in:
2023-12-28 03:03:40 +01:00
parent 238c215d35
commit 7c7ca1742b
3 changed files with 61 additions and 20 deletions

View File

@ -5,34 +5,36 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Java CI with Gradle
name: Build & test the project
on:
push:
branches: [ master ]
branches:
- master
# Run on any pull request
pull_request:
branches: [ master ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# follows https://en.wikipedia.org/wiki/Java_version_history#Release_table
java-versions: ['8', '11', '17', '21']
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
- name: Set up Java ${{ matrix.java-versions }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-versions }}
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701
- name: Build & Test
uses: gradle/gradle-build-action@v2
with:
arguments: build
arguments: build test

View File

@ -9,35 +9,34 @@ name: Gradle Package
on:
release:
types: [created]
types:
- created
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '8' # use the lowest version from https://en.wikipedia.org/wiki/Java_version_history#Release_table
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Build with Gradle
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701
- name: Build the project
uses: gradle/gradle-build-action@v2
with:
arguments: build
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701
uses: gradle/gradle-build-action@v2
with:
arguments: publish
env: