v5.2.2 #29
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: Release | |
on: | |
release: | |
types: [ published ] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set version | |
uses: actions/github-script@v6 | |
id: set_version | |
with: | |
script: | | |
const tagName = context.payload.release.tag_name | |
const version = tagName.replace('v', '') | |
core.setOutput('version', version) | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 8 | |
distribution: temurin | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Build with Apache Maven | |
run: ./mvnw --batch-mode package | |
- name: Set artifact version | |
run: ./mvnw --batch-mode versions:set -DnewVersion=${{ steps.set_version.outputs.version }} | |
- name: Publish package to Apache Maven Central | |
run: ./mvnw --batch-mode deploy | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
outputs: | |
version: ${{ steps.set_version.outputs.version }} | |
update-version: | |
needs: [ publish ] | |
permissions: | |
contents: write # for peter-evans/create-pull-request to create branch | |
pull-requests: write # for peter-evans/create-pull-request to create a PR | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
fetch-depth: 0 | |
- name: Update Maven version in README.md | |
run: sed -i 's/<version>.*<\/version>/<version>${{ needs.publish.outputs.version }}<\/version>/g' README.md | |
- name: Update Gradle version in README.md | |
run: sed -i "s/implementation 'org.semver4j:semver4j:.*/implementation 'org.semver4j:semver4j:${{ needs.publish.outputs.version }}'/g" README.md | |
- name: Show diff | |
run: git diff | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5.0.2 | |
with: | |
commit-message: Update versions after ${{ github.event.release.tag_name }} release | |
title: Update versions after ${{ github.event.release.tag_name }} release | |
body: Update versions after ${{ github.event.release.tag_name }} release | |
branch: update-versions-${{ github.event.release.tag_name }} | |
labels: | | |
documentation | |
skip-changelog |