Release new version #75
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 new version | |
on: | |
workflow_dispatch: | |
inputs: | |
semverBump: | |
description: 'The type of Semantic Version bump (patch, minor or major)' | |
required: true | |
default: 'patch' | |
jobs: | |
deploy-release: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
pull-requests: write | |
contents: write | |
repository-projects: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup JDK with maven | |
uses: ./.github/actions/setup-jdk-with-maven | |
- name: Create new Semantic Version | |
uses: ./.github/actions/bump-maven-version | |
id: bumpedVersion | |
with: | |
bump: ${{ github.event.inputs.semverBump }} | |
- name: Set git user and email | |
uses: ./.github/actions/set-git-username | |
- name: Create release commit using PR and automatic merge | |
if: ${{ steps.bumpedVersion.outputs.was_bumped == 'true' }} | |
uses: ./.github/actions/create-release-commit | |
with: | |
github_token: ${{ secrets.GH_STAPI_BOT_TOKEN }} | |
bump: ${{ github.event.inputs.semverBump }} | |
version: ${{ steps.bumpedVersion.outputs.version }} | |
- name: Checkout updated master | |
uses: actions/checkout@v3 | |
with: | |
ref: master | |
- name: Check if version exists on Sonatype | |
uses: ./.github/actions/check-sonatype-version | |
id: check_version | |
with: | |
group_id: 'ai.stapi' | |
artifact_id: 'core' | |
version: ${{ steps.bumpedVersion.outputs.version }} | |
- name: Setup JDK for sonatype release | |
uses: ./.github/actions/setup-jdk-for-sonatype-release | |
with: | |
ossrh_gpg_secret_key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} | |
- name: Deploy release to Sonatype | |
if: ${{ steps.check_version.outputs.version_exists == 'false' }} | |
uses: ./.github/actions/deploy-sonatype | |
with: | |
ossrh_username: ${{ secrets.OSSRH_USERNAME }} | |
ossrh_token: ${{ secrets.OSSRH_TOKEN }} | |
ossrh_gpg_secret_key_password: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} | |
- name: Tag the release idempotently | |
run: | | |
if ! git ls-remote --tags origin | grep ${{ steps.bumpedVersion.outputs.version }} >/dev/null; then | |
git tag ${{ steps.bumpedVersion.outputs.version }} | |
git push origin ${{ steps.bumpedVersion.outputs.version }} | |
fi | |
- name: Check if release exists | |
id: check_release | |
uses: ./.github/actions/check-github-release-exists | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ steps.bumpedVersion.outputs.version }} | |
- name: Publish release on github | |
if: steps.check_release.outputs.exists == 'false' | |
uses: ./.github/actions/publish-release-github | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
release_version: ${{ steps.bumpedVersion.outputs.version }} | |
- name: Set next SNAPSHOT version | |
uses: ./.github/actions/bump-maven-version | |
id: bumpedVersionSnapshot | |
with: | |
bump: 'snapshot' | |
- name: Create snapshot commit using PR and automatic merge | |
uses: ./.github/actions/create-snapshot-commit | |
with: | |
github_token: ${{ secrets.GH_STAPI_BOT_TOKEN }} | |
version: ${{ steps.bumpedVersionSnapshot.outputs.version }} | |
- name: Checkout updated master | |
uses: actions/checkout@v3 | |
with: | |
ref: master | |