Release (0.0.4) #10
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: Release | |
run-name: ${{ format('{0} ({1})', github.workflow, github.event.inputs.release-version) }} | |
on: | |
workflow_dispatch: | |
inputs: | |
release-version: | |
description: The version to release | |
required: true | |
next-development-version: | |
description: The next development version | |
required: true | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
cache: 'maven' | |
check-latest: true | |
# https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#publishing-using-apache-maven | |
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml | |
server-username: MAVEN_USERNAME # env variable for username in deploy | |
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy | |
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Prepare Release | |
run: mvn versions:set -DnewVersion="${{ github.event.inputs.release-version }}" | |
- name: Verify Release | |
run: mvn verify | |
- name: Tag the ${{ github.event.inputs.release-version }} Release | |
run: | | |
git config --local user.name "Rob Winch" | |
git config --local user.email "[email protected]" | |
git commit -am 'Release ${{ github.event.inputs.release-version }} [no ci]' | |
git tag "v${{ github.event.inputs.release-version }}" | |
- name: Push to Maven Central | |
run: | | |
mvn deploy -Possrh | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} | |
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Push the Tag | |
run: git push origin "v${{ github.event.inputs.release-version }}" | |
- name: Prepare Next Development Version | |
run: | | |
mvn versions:set -DnewVersion="${{ github.event.inputs.next-development-version }}" | |
git commit -am 'Next Development Version ${{ github.event.inputs.next-development-version }}' | |
- name: Update README to latest Release | |
run: | | |
sed -i 's/^:version: .*/:version: ${{ github.event.inputs.release-version }}/' README.adoc | |
git commit -am 'Update README to Release ${{ github.event.inputs.release-version }}' | |
- name: Push the Commits | |
run: git push origin ${GITHUB_REF_NAME:-main} |