Feature/use gradle plugin #178
Workflow file for this run
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: jpa | |
on: | |
create: | |
branches: [ 'release/**' ] | |
push: | |
branches: [ main ] | |
tags: [ 'jpa/v*' ] | |
paths: | |
- 'buildSrc' | |
- 'jpa-ext/**' | |
- '.github/workflows/jpa.yml' | |
- '.github/actions/*.yml' | |
pull_request: | |
types: [ opened, synchronize, reopened, closed ] | |
branches: [ main ] | |
paths: | |
- 'buildSrc' | |
- 'jpa-ext/**' | |
- '.github/workflows/jpa.yml' | |
- '.github/actions/*.yml' | |
env: | |
PROFILE: jpa | |
jobs: | |
context: | |
uses: ./.github/workflows/subwf-context.yml | |
with: | |
# https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations | |
profile: 'jpa' | |
gitTagPrefix: 'jpa/v' | |
versionFile: jpa-ext/gradle.properties | |
secrets: | |
githubToken: ${{ secrets.OSS_GITHUB_TOKEN }} | |
gpgKey: ${{ secrets.CI_GPG_PRIVATE_KEY }} | |
gpgPassphrase: ${{ secrets.CI_GPG_PASSPHARSE }} | |
build: | |
needs: context | |
if: needs.context.outputs.shouldBuild == 'true' | |
strategy: | |
matrix: | |
java: [ '8', '11', '17' ] | |
os: [ 'ubuntu-latest', 'windows-latest' ] | |
name: Build & Test Java ${{ matrix.java }} (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/[email protected] | |
- name: Build | |
uses: ./.github/actions/gha-build | |
with: | |
profile: ${{ env.PROFILE }} | |
version: ${{ needs.context.outputs.version }} | |
semanticVersion: ${{ needs.context.outputs.semanticVersion }} | |
hashVersion: ${{ needs.context.outputs.commitId }} | |
javaVersion: ${{ matrix.java }} | |
- name: Test | |
shell: bash | |
run: ./gradlew test -Pprofile=${{ env.PROFILE }} | |
publish: | |
needs: [ context, build ] | |
if: needs.context.outputs.shouldPublish == 'true' || needs.context.outputs.isRelease == 'true' | |
uses: ./.github/workflows/subwf-publish.yml | |
with: | |
profile: 'jpa' | |
version: ${{ needs.context.outputs.version }} | |
semanticVersion: ${{ needs.context.outputs.semanticVersion }} | |
hashVersion: ${{ needs.context.outputs.commitId }} | |
isRelease: ${{ needs.context.outputs.isRelease }} | |
secrets: | |
ossrhUser: ${{ secrets.OSS_SONATYPE_USER }} | |
ossrhToken: ${{ secrets.OSS_SONATYPE_PASSWORD }} | |
gpgKey: ${{ secrets.CI_GPG_PRIVATE_KEY }} | |
gpgPassphrase: ${{ secrets.CI_GPG_PASSPHARSE }} | |
release: | |
runs-on: ubuntu-latest | |
needs: [ context, publish ] | |
if: needs.context.outputs.isRelease == 'true' | |
steps: | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: Release ${{ env.PROFILE }} ${{ needs.context.outputs.version }} | |
tag_name: ${{ needs.context.outputs.branch }} | |
generate_release_notes: false |