fix: automate releases #13
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: CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# This allows a subsequently queued workflow run to interrupt previous runs | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
matrix: | |
java-version: | |
- 11 | |
os: | |
- ubuntu-latest | |
# - windows-2019 | |
# in case one combination fails, we still want to see results from others | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
permissions: | |
contents: write # to be able to publish a GitHub release | |
issues: write # to be able to comment on released issues | |
pull-requests: write # to be able to comment on released pull requests | |
id-token: write # to enable use of OIDC for npm provenance | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java-version }} | |
distribution: 'zulu' | |
- uses: gradle/gradle-build-action@v2 | |
name: Build with Gradle | |
with: | |
arguments: build | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
if: github.ref == 'refs/heads/master' | |
with: | |
node-version: 18.x | |
cache: "npm" | |
- name: Install npm dependencies | |
if: github.ref == 'refs/heads/master' | |
run: npm install | |
- name: Update and tag version | |
if: github.ref == 'refs/heads/master' | |
run: npx semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: gradle/gradle-build-action@v2 | |
if: github.ref == 'refs/heads/master' | |
name: Publish to Maven Central | |
env: | |
ORG_GRADLE_PROJECT_signingKey: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGKEY}} | |
ORG_GRADLE_PROJECT_signingKeyId: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID}} | |
ORG_GRADLE_PROJECT_signingPassword: ${{secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD}} | |
ORG_GRADLE_PROJECT_sonatypeUsername: ${{secrets.ORG_GRADLE_PROJECT_SONATYPEUSERNAME}} | |
ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.ORG_GRADLE_PROJECT_SONATYPEPASSWORD}} | |
with: | |
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepositor |