On push to release branch #7
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: On push to release branch | |
on: | |
push: | |
branches: [release] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.release.outputs.release }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set release | |
id: semrel | |
uses: go-semantic-release/action@v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
allow-initial-development-versions: true | |
force-bump-patch-version: true | |
# For whatever reason, this silly tool won't let you do releases from branches | |
# other than the default branch unless you pass this flag, which doesn't seem | |
# to actually have anything to do with CI: | |
# https://github.com/go-semantic-release/semantic-release/blob/master/cmd/semantic-release/main.go#L173-L194 | |
# https://github.com/go-semantic-release/condition-github/blob/4c8af3fc516151423fff2f77eb08bf7082570676/pkg/condition/github.go#L42-L44 | |
custom-arguments: '--no-ci' | |
- name: Output release | |
id: release | |
run: echo "release=${{ steps.semrel.outputs.version }}" >> $GITHUB_OUTPUT | |
publish: | |
needs: [ release ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'corretto' | |
- name: Build project | |
run: make build | |
- name: Publish to sonatype | |
env: | |
SONATYPE_SIGNING_KEY: ${{ secrets.SONATYPE_SIGNING_KEY }} | |
SONATYPE_SIGNING_KEY_PASSWORD: ${{ secrets.SONATYPE_SIGNING_KEY_PASSWORD }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
ORG_GRADLE_PROJECT_version: ${{ needs.release.outputs.version }} | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: publishToSonatype closeSonatypeStagingRepository |