-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9a06ab
commit 90df89c
Showing
6 changed files
with
399 additions
and
68 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release-version: | ||
description: 'Release version to remove e.g 3.0.0. It will delete tag v3.0.0 and branch v3.0.x' | ||
required: true | ||
revert-to: | ||
description: 'The commit to revert to on the branch that originated the release' | ||
required: true | ||
|
||
jobs: | ||
rollback: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
- name: Cache Maven packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
!~/.m2/repository/fr/sii/ | ||
key: ${{ runner.os }}-m2-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2-${{ secrets.CACHE_VERSION }} | ||
- name: Prepare git | ||
run: | | ||
git config user.email [email protected] | ||
git config user.name github-actions | ||
- name: "Remove tag" | ||
continue-on-error: true | ||
run: | | ||
git push origin --delete v${{ github.event.inputs.release-version }} | ||
- name: "Remove fix branch" | ||
continue-on-error: true | ||
run: | | ||
RELEASE_VERSION=${{ github.event.inputs.release-version }} | ||
FIX_BRANCH="v${RELEASE_VERSION%.*}.x" | ||
git push origin --delete "$FIX_BRANCH" | ||
- name: "Remove release commits" | ||
continue-on-error: true | ||
run: | | ||
git pull | ||
LATEST_COMMIT="$(git log -1 --format=%H)" | ||
echo "LATEST_COMMIT=$LATEST_COMMIT" | ||
echo "github.event.inputs.revert-to=${{ github.event.inputs.revert-to }}" | ||
if [ "$LATEST_COMMIT" != "${{ github.event.inputs.revert-to }}" ]; then | ||
ROLLBACK_BACKUP_BRANCH="rollback/backup/$LATEST-COMMIT" | ||
git branch "$ROLLBACK_BACKUP_BRANCH" | ||
git push origin "$ROLLBACK_BACKUP_BRANCH" | ||
git reset --hard ${{ github.event.inputs.revert-to }} | ||
git push --force | ||
fi | ||
# TODO: remove artifact from Maven repository: possible ? | ||
# - name: "Remove artifact" | ||
# if: always() | ||
# run: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,40 @@ | ||
name: Release | ||
|
||
# Process | ||
# ------- | ||
# | ||
# 1) mvn release:prepare | ||
# => change version for release in pom.xml files to vX.Y.0 | ||
# => update readme | ||
# => run unit+integration tests | ||
# => commit | ||
# => tag | ||
# => change version for future developments in pom.xml files to vU.V.0-SNAPSHOT | ||
# | ||
# 2) Trigger a full build on tagged version and wait for result | ||
# => build from tag | ||
# => run unit+integration tests | ||
# => run classpath-tests | ||
# => generate javadoc | ||
# | ||
# 3) mvn release:perform to finish the release | ||
# => deploy on Sonatype | ||
# | ||
# 4) Trigger a site generation on tagged version | ||
# | ||
# 5) Create branch for fixes | ||
# => change versions to vX.Y.1-SNAPSHOT | ||
# | ||
# | ||
# Rollback | ||
# -------- | ||
# | ||
# 1) mvn release:rollback | ||
# 2) delete tag | ||
# 3) restore previous commit (before version changes) | ||
# 3) mvn release:clean | ||
# 4) remove from Sonatype if deployed | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
|
@@ -11,9 +46,231 @@ on: | |
description: 'Next dev version' | ||
required: true | ||
default: '3.1.0-SNAPSHOT' | ||
fix-version: | ||
description: 'Fixes version' | ||
required: true | ||
default: '3.0.1-SNAPSHOT' | ||
|
||
jobs: | ||
mutation-tests: | ||
# FIXME: maven-release-plugin can't be used due to issue: https://issues.apache.org/jira/browse/MRELEASE-920 | ||
# release: | ||
# runs-on: ubuntu-18.04 | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - uses: actions/setup-java@v1 | ||
# with: | ||
# java-version: 8 | ||
# - name: Cache Maven packages | ||
# uses: actions/cache@v2 | ||
# with: | ||
# path: | | ||
# ~/.m2/repository | ||
# !~/.m2/repository/fr/sii/ | ||
# key: ${{ runner.os }}-m2-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/pom.xml') }} | ||
# restore-keys: ${{ runner.os }}-m2-${{ secrets.CACHE_VERSION }} | ||
# - name: "Release" | ||
# run: | ||
# ./mvnw release:prepare | ||
# -DreleaseVersion=${{ github.event.inputs.release-version }} | ||
# -DdevelopmentVersion=${{ github.event.inputs.next-dev-version }} | ||
# -B | ||
release: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
- name: Cache Maven packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
!~/.m2/repository/fr/sii/ | ||
key: ${{ runner.os }}-m2-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2-${{ secrets.CACHE_VERSION }} | ||
- name: Prepare git | ||
run: | | ||
git config user.email [email protected] | ||
git config user.name github-actions | ||
- name: "Set release version (${{ github.event.inputs.release-version }})" | ||
run: | | ||
./mvnw versions:set -DnewVersion=${{ github.event.inputs.release-version }} -DprocessAllModules | ||
./mvnw com.google.code.maven-replacer-plugin:replacer:replace -N | ||
./mvnw versions:commit | ||
- name: "Generate README.adoc" | ||
run: | ||
./mvnw initialize '-Dreadme.skip=false' | ||
- name: "Build to ensure that it works fine" | ||
run: | ||
./mvnw clean install '-Dmaven.test.redirectTestOutputToFile=true' | ||
- name: "Commit release version" | ||
run: | | ||
git add . | ||
git commit -m "release(${{ github.event.inputs.release-version }}) Prepare for release" | ||
git push | ||
test-release: | ||
needs: [release] | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: aurelien-baudet/workflow-dispatch@master | ||
with: | ||
token: ${{ secrets.TRIGGER_WORKFLOW_TOKEN }} | ||
workflow: build.yml | ||
wait-for-completion-interval: 10m | ||
wait-for-completion-timeout: 4h | ||
# ref: v${{ github.event.inputs.release-version }} | ||
|
||
deploy-release: | ||
needs: [test-release] | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
- name: Cache Maven packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
!~/.m2/repository/fr/sii/ | ||
key: ${{ runner.os }}-m2-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2-${{ secrets.CACHE_VERSION }} | ||
- name: Prepare git | ||
run: | | ||
git config user.email [email protected] | ||
git config user.name github-actions | ||
- run: git pull | ||
- name: "Tag release version" | ||
run: | | ||
git tag -a "v${{ github.event.inputs.release-version }}" -m "release(${{ github.event.inputs.release-version }}) Release" | ||
git push origin "v${{ github.event.inputs.release-version }}" | ||
- name: "Import GPG key" | ||
uses: crazy-max/ghaction-import-gpg@v3 | ||
with: | ||
gpg-private-key: ${{ secrets.RELEASE_GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.RELEASE_GPG_PASSPHRASE }} | ||
# - name: "Deploy release" | ||
# run: | ||
# ./mvnw -Prelease deploy | ||
# --settings .github/deploy-settings.xml | ||
# '-DskipTests=true' | ||
# -B | ||
|
||
set-next-version: | ||
needs: [deploy-release] | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
- name: Cache Maven packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
!~/.m2/repository/fr/sii/ | ||
key: ${{ runner.os }}-m2-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2-${{ secrets.CACHE_VERSION }} | ||
- name: Prepare git | ||
run: | | ||
git config user.email [email protected] | ||
git config user.name github-actions | ||
- run: git pull | ||
- name: "Set next development version on master (${{ github.event.inputs.next-dev-version }})" | ||
run: | | ||
./mvnw versions:set -DnewVersion=${{ github.event.inputs.next-dev-version }} -DprocessAllModules | ||
./mvnw com.google.code.maven-replacer-plugin:replacer:replace -N | ||
./mvnw versions:commit | ||
- name: "Generate README.adoc" | ||
run: | ||
./mvnw initialize '-Dreadme.skip=false' | ||
- name: "Commit next development iteration" | ||
run: | | ||
git add . | ||
git commit -m "release(${{ github.event.inputs.release-version }}) Prepare for next development iteration" | ||
git push | ||
update-site: | ||
needs: [set-next-version] | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: aurelien-baudet/workflow-dispatch@master | ||
with: | ||
token: ${{ secrets.TRIGGER_WORKFLOW_TOKEN }} | ||
workflow: update-site.yml | ||
ref: v${{ github.event.inputs.release-version }} | ||
|
||
create-or-update-fix-branch: | ||
needs: [update-site] | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
- name: Cache Maven packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
!~/.m2/repository/fr/sii/ | ||
key: ${{ runner.os }}-m2-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2-${{ secrets.CACHE_VERSION }} | ||
- name: Prepare git | ||
run: | | ||
git config user.email [email protected] | ||
git config user.name github-actions | ||
- name: "Get fix branch" | ||
run: | ||
RELEASE_VERSION=${{ github.event.inputs.release-version }} | ||
FIX_BRANCH="v${RELEASE_VERSION%.*}.x" | ||
echo "FIX_BRANCH=$FIX_BRANCH" >> $GITHUB_ENV | ||
- name: "Set version" | ||
run: | | ||
echo "FIX_BRANCH=$FIX_BRANCH" | ||
EXISTS=$(git ls-remote --heads origin ${FIX_BRANCH}) | ||
if [ -z "$EXISTS" ]; then | ||
git checkout "v${{ github.event.inputs.release-version }}" | ||
git checkout -b "$FIX_BRANCH" | ||
else | ||
git checkout "$FIX_BRANCH" | ||
fi | ||
./mvnw versions:set -DnewVersion=${{ github.event.inputs.fix-version }} -DprocessAllModules | ||
./mvnw com.google.code.maven-replacer-plugin:replacer:replace -N | ||
./mvnw versions:commit | ||
- name: "Generate README.adoc" | ||
run: | ||
./mvnw initialize '-Dreadme.skip=false' | ||
- name: "Create fix branch or update it" | ||
run: | ||
git add . | ||
git commit -m "chore(bump) Change version number for next fix version" | ||
git push | ||
|
||
rollback: | ||
needs: [release, test-release, deploy-release, set-next-version, update-site, create-or-update-fix-branch] | ||
if: always() | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- run: echo "foo" | ||
- uses: aurelien-baudet/workflow-dispatch@master | ||
with: | ||
token: ${{ secrets.TRIGGER_WORKFLOW_TOKEN }} | ||
inputs: | | ||
{ | ||
"release-version": "${{ github.event.inputs.release-version }}", | ||
"revert-to": "${{ github.sha }}" | ||
} | ||
workflow: release-rollback.yml | ||
wait-for-completion-interval: 1m | ||
wait-for-completion-timeout: 1h | ||
|
Oops, something went wrong.