-
Notifications
You must be signed in to change notification settings - Fork 95
104 lines (96 loc) · 4.6 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Axioms of the release pipeline:
# - Each release starts from timefold-solver by running this Github Action.
# - Each individual repository can only start its own release when its dependencies are fully released.
# timefold-solver-enterprise depends on timefold-solver
# timefold-quickstarts depends on timefold-solver
# timefold-website releases last
# - Each individual repository uses 999-SNAPSHOT as its development version, even on micro branches.
#
# Should any of these axioms change, the release pipeline will need to be (significantly) refactored.
# 0.8.x releases existed before this pipeline; they are done differently, similarities are coincidental.
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g. 1.0.0)'
required: true
sourceBranch:
description: 'Branch to cut the release from'
default: main
required: true
releaseBranch:
description: 'Release branch to create (e.g. 1.0.x for version 1.0.0; once created, branch protection rules apply)'
default: dry_run
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@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.sourceBranch }}
- 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@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
# Need Maven 3.9.0+ to recognize MAVEN_ARGS.
- name: Set up Maven
uses: stCarolas/setup-maven@v5
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 "build: 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_MAVEN_CENTRAL_TOKEN_USER }}
JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.JRELEASER_MAVEN_CENTRAL_TOKEN }}
- name: JReleaser release output
uses: actions/upload-artifact@v4
if: always()
with:
name: jreleaser-release
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
# Pull Request will be created with the changes and a summary of next steps.
- name: Put back the 999-SNAPSHOT version on the release branch
run: |
git checkout -B ${{ github.event.inputs.releaseBranch }}-put-back-999-snapshot
mvn -Dfull versions:set -DnewVersion=999-SNAPSHOT
git commit -am "build: move back to 999-SNAPSHOT"
git push origin ${{ github.event.inputs.releaseBranch }}-put-back-999-snapshot
gh pr create --reviewer triceo --base ${{ github.event.inputs.releaseBranch }} --head ${{ github.event.inputs.releaseBranch }}-put-back-999-snapshot --title "build: move back to 999-SNAPSHOT" --body-file .github/workflows/release-pr-body.md
env:
GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }}