Publish to GitHub Packages #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to GitHub Packages | |
on: | |
workflow_dispatch: | |
inputs: | |
dry-run: | |
description: 'Check to publish locally. Useful for testing.' | |
type: boolean | |
default: false | |
required: false | |
jobs: | |
publish-gpr: | |
runs-on: macos-latest | |
steps: | |
- name: Echo inputs | |
run: | | |
echo "Dry run: ${{ inputs.dry-run }}" | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up JDK | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Build | |
run: ./gradlew build | |
- name: Publish to local maven repo | |
run: | | |
./gradlew publishAllPublicationsToProjectLocalRepository | |
- name: Upload artifacts to action summary | |
run: ./gradlew archiveAllPublicationsFromProjectLocalRepository | |
- name: Publish artifacts to GitHub Packages | |
env: | |
GPR_USERNAME: ${{ secrets.GPR_USERNAME }} | |
GPR_PASSWORD: ${{ secrets.GPR_PASSWORD }} | |
if: ${{ inputs.dry-run != true }} | |
run: ./gradlew publishAllPublicationsToGitHubPackagesRepository |