Release #43
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: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Release version (e.g. 0.8.40)' | |
required: true | |
sourceBranch: | |
description: 'Branch to cut the release from' | |
default: 0.8.x | |
required: true | |
releaseBranch: | |
description: 'Release branch to create (e.g. 0.8.40.x for version 0.8.40; once created, branch protection rules apply)' | |
default: dry_run | |
required: true | |
nextVersion: | |
description: 'Next version after release (e.g. 0.8.41, -SNAPSHOT will be added automatically)' | |
required: true | |
nextMicroVersion: | |
description: 'Next version after release for release branch (e.g. 0.8.41.1, -SNAPSHOT will be added automatically)' | |
required: true | |
dryRun: | |
description: 'Do a dry run? (true or false)' | |
default: true | |
required: true | |
jobs: | |
build: | |
env: | |
MAVEN_ARGS: "--no-transfer-progress --batch-mode" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout timefold-solver | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Create release branch and switch to it | |
run: | | |
git config user.name "Timefold Release Bot" | |
git config user.email "[email protected]" | |
git checkout -b ${{ github.event.inputs.releaseBranch }} | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: 'maven' | |
# Need Maven 3.9.0+ to recognize MAVEN_ARGS. | |
- name: Set up Maven | |
uses: stCarolas/[email protected] | |
with: | |
maven-version: 3.9.3 | |
# We skip tests in dry run, to make the process faster. | |
# Technically, this goes against the main reason for doing a dry run; to eliminate potential problems. | |
# But unless something catastrophic happened, PR checks on source branch already ensured that all tests pass. | |
- name: Set release version and build release | |
run: | | |
mvn -Dfull versions:set -DnewVersion=${{ github.event.inputs.version }} | |
mvn -Dfull deploy -DskipTests=${{ github.event.inputs.dryRun }} -DaltDeploymentRepository=local::default::file://`pwd`/target/staging-deploy | |
cp docs/target/antora-template.yml docs/src/antora.yml | |
git add docs/src/antora.yml | |
find . -name 'pom.xml' | xargs git add | |
git commit -m "chore: release version ${{ github.event.inputs.version }}" | |
git push origin ${{ github.event.inputs.releaseBranch }} | |
- name: Run JReleaser | |
uses: jreleaser/release-action@v2 | |
env: | |
JRELEASER_DRY_RUN: ${{ github.event.inputs.dryRun }} | |
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }} | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }} | |
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} | |
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }} | |
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} | |
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.JRELEASER_NEXUS2_USERNAME }} | |
JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.JRELEASER_NEXUS2_PASSWORD }} | |
- name: JReleaser release output | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: jreleaser-release | |
path: | | |
out/jreleaser/trace.log | |
out/jreleaser/output.properties | |
- name: Set micro snapshot version on the release branch | |
run: | | |
git checkout -B ${{ github.event.inputs.releaseBranch }}-bump-to-next-micro-version | |
mvn -Dfull versions:set -DnewVersion=${{ github.event.inputs.nextMicroVersion }}-SNAPSHOT | |
git commit -am "chore: move to ${{ github.event.inputs.nextMicroVersion }}-SNAPSHOT" | |
git push origin ${{ github.event.inputs.releaseBranch }}-bump-to-next-micro-version | |
gh pr create --reviewer triceo,ge0ffrey --base ${{ github.event.inputs.releaseBranch }} --head ${{ github.event.inputs.releaseBranch }}-bump-to-next-micro-version --title "chore: move to ${{ github.event.inputs.nextMicroVersion }}-SNAPSHOT" --body-file .github/workflows/release-pr-body-stable.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }} | |
- name: Switch back to source branch and set snapshot version | |
run: | | |
git checkout ${{ github.event.inputs.sourceBranch }} | |
git checkout -B ${{ github.event.inputs.releaseBranch }}-bump-to-next-minor-version | |
mvn -Dfull versions:set -DnewVersion=${{ github.event.inputs.nextVersion }}-SNAPSHOT | |
cp docs/target/antora-template.yml docs/src/antora.yml | |
git add docs/src/antora.yml | |
git commit -am "chore: move to ${{ github.event.inputs.nextVersion }}-SNAPSHOT" | |
git push origin ${{ github.event.inputs.releaseBranch }}-bump-to-next-minor-version | |
gh pr create --reviewer triceo,ge0ffrey --base ${{ github.event.inputs.sourceBranch }} --head ${{ github.event.inputs.releaseBranch }}-bump-to-next-minor-version --title "chore: move to ${{ github.event.inputs.nextVersion }}-SNAPSHOT" --body-file .github/workflows/release-pr-body.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }} |