Merge pull request #271 from oss-slu/workflows #160
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: Build and Release Library | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build-library: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Change wrapper permissions | |
run: chmod +x pi4micronaut-utils/gradlew | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build | |
build-root-directory: pi4micronaut-utils/ | |
- name: Execute Gradle build | |
working-directory: pi4micronaut-utils | |
run: ./gradlew shadowJar | |
publish-jar: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
if: github.event_name == 'workflow_dispatch' | |
needs: build-library | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Change wrapper permissions | |
run: chmod +x pi4micronaut-utils/gradlew | |
- name: Publish Library | |
working-directory: pi4micronaut-utils | |
env: | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
GPG_KEY: ${{ secrets.GPG_KEY }} | |
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} | |
run: ./gradlew clean publish --info |