Skip to content

Release new version #93

Release new version

Release new version #93

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
strategy:
matrix:
repo: [ 'standard-api/axon-driver' ]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup JDK with maven
uses: ./.github/actions/setup-jdk-with-maven
- name: Bump new Semantic Version in maven
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 for maven
uses: ./.github/actions/create-release-commit-maven
with:
bump: ${{ github.event.inputs.semverBump }}
version: ${{ steps.bumpedVersion.outputs.version }}
- name: Create release commit using PR and automatic merge
if: ${{ steps.bumpedVersion.outputs.was_bumped == 'true' }}
uses: ./.github/actions/create-release-pr-and-merge
with:
github_token: ${{ secrets.GH_STAPI_BOT_TOKEN }}
bump: ${{ github.event.inputs.semverBump }}
version: ${{ steps.bumpedVersion.outputs.version }}
repository: core
- 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-all-in-order
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
id: publish_release_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: Publish release notifications
if: steps.check_release.outputs.exists == 'false'
uses: ./.github/actions/publish-release-notifications
with:
discord_webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}
release_version: ${{ steps.bumpedVersion.outputs.version }}
repository: "standard-api/core"
changelog: ${{ steps.publish_release_github.outputs.changelog }}
- name: Set next SNAPSHOT version
uses: ./.github/actions/bump-maven-version
id: bumpedVersionSnapshot
with:
bump: 'snapshot'
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.GH_STAPI_BOT_TOKEN }}
repository: ${{ matrix.repo }}
event-type: stapi-core-released
client-payload: '{"new_version": "${{ steps.bumpedVersion.outputs.version }}","new_snapshot_version": "${{ steps.bumpedVersionSnapshot.outputs.version }}","bumpType": "${{ github.event.inputs.semverBump }}"}'
- 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 }}
repository: 'core'
- name: Checkout updated master
uses: actions/checkout@v3
with:
ref: master