Merge pull request #11 from arconia-io/dependabot/gradle/org.jrelease… #37
This file contains 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: Commit Stage | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Java | |
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0 | |
with: | |
java-version: 17 | |
distribution: temurin | |
cache: gradle | |
- name: Compile and test | |
run: ./gradlew build -Dorg.gradle.parallel=false | |
- name: Generate SBOMs | |
run: ./gradlew cyclonedxBom | |
- name: Stage artifacts to local directory | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: ./gradlew publish | |
- name: Deploy and release artifacts | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
VERSION=$(./gradlew properties | grep 'version:' | awk '{print $2}') | |
if [[ $VERSION == *"SNAPSHOT"* ]]; then | |
./gradlew jreleaserDeploy | |
else | |
./gradlew jreleaserFullRelease | |
fi | |
env: | |
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME }} | |
JRELEASER_NEXUS2_MAVEN_CENTRAL_TOKEN: ${{ secrets.JRELEASER_NEXUS2_MAVEN_CENTRAL_TOKEN }} | |
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }} | |
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} | |
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload JReleaser output | |
if: always() | |
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 | |
with: | |
name: jreleaser-output | |
path: | | |
build/jreleaser/trace.log | |
build/jreleaser/output.properties |