Java (Release) #6
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: Java (Release) | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseType: | |
description: 'Release type - major, minor or patch' | |
required: true | |
default: 'minor' | |
options: | |
- 'major' | |
- 'minor' | |
- 'patch' | |
defaults: | |
run: | |
working-directory: visual-java | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Maven Central Repository | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
server-id: ossrh | |
server-username: MVN_CENTRAL_USERNAME | |
server-password: MVN_CENTRAL_PASSWORD | |
- name: Setup Git | |
if: ${{ steps.prep.outputs.tag_name == '' }} | |
run: | | |
git config --global user.name "sauce-visual-bot" | |
git config --global user.email "[email protected]" | |
- name: upgrade & push version | |
id: upgrade | |
run: | | |
current_version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) | |
new_version=$(./scripts/bump_version.sh -c $current_version -r ${{ github.event.inputs.releaseType }}) | |
mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$new_version | |
tag_name="java-$new_version" | |
git add ./pom.xml | |
git commit -m "[release] $tag_name" | |
git tag $tag_name | |
git push | |
git push origin $tag_name | |
echo "version=$new_version" >> "$GITHUB_OUTPUT" | |
echo "tag_name=$tag_name" >> "$GITHUB_OUTPUT" | |
- name: Import GPG signing key | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.MVN_CENTRAL_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.MVN_CENTRAL_GPG_PASSPHRASE }} | |
- name: Release to Maven repo | |
run: | | |
mvn -P release -Dgpg.passphrase="${{ secrets.MVN_CENTRAL_GPG_PASSPHRASE }}" \ | |
-Drevision=${{ steps.upgrade.outputs.version }} deploy | |
env: | |
MVN_CENTRAL_USERNAME: ${{ secrets.MVN_CENTRAL_USERNAME }} | |
MVN_CENTRAL_PASSWORD: ${{ secrets.MVN_CENTRAL_PASSWORD }} | |
- name: Github Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
fail_on_unmatched_files: true | |
tag_name: ${{ steps.upgrade.outputs.tag_name }} | |
files: visual-java/target/java-client-${{ steps.upgrade.outputs.version }}.jar | |
generate_release_notes: true |