Skip to content

Commit

Permalink
ci: revamped release workflow
Browse files Browse the repository at this point in the history
Uses JReleaser to generate changelogs, and performs some
simplifications over the existing multi-steps workflow.

Also introduces a "justfile" to capture some existing bash
scripts in a central location.
  • Loading branch information
jponge committed Sep 19, 2023
1 parent 446c3f2 commit 067a095
Show file tree
Hide file tree
Showing 18 changed files with 153 additions and 326 deletions.
14 changes: 0 additions & 14 deletions .build/bump-to-next-version.sh

This file was deleted.

17 changes: 0 additions & 17 deletions .build/bump-to-release-version.sh

This file was deleted.

15 changes: 0 additions & 15 deletions .build/clear-revapi-justifications.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .build/deploy-snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ init_gpg
git fetch origin --tags
git reset --hard
git checkout main
./mvnw -B clean deploy -DskipTests -Prelease -s maven-settings.xml
./mvnw --no-transfer-progress -B clean deploy -DskipTests -Prelease -s maven-settings.xml

81 changes: 81 additions & 0 deletions .build/justfile-for-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Should be run as:
# just -f .build/justfile-for-release -d . (...)

# Just echo the purpose of this file
purpose:
@echo "This file is used to automate some release tasks"
@echo "(running in `pwd`)"

# Perform a release
perform-release: pre-release release post-release
@echo "🎉 Successfully released Mutiny ${RELEASE_VERSION} 🚀"

# Decrypt secrets
decrypt-secrets:
@echo "Decrypting smallrye signature"
gpg --quiet --batch --yes --decrypt --passphrase="${SECRET_FILES_PASSPHRASE}" \
--output smallrye-sign.asc .build/smallrye-sign.asc.gpg
@echo "Decrypting Maven settings"
gpg --quiet --batch --yes --decrypt --passphrase="${SECRET_FILES_PASSPHRASE}" \
--output maven-settings.xml .build/maven-settings.xml.gpg

# Initialize GnuPG
init-gpg:
@echo "GnuPG setup"
gpg --fast-import --no-tty --batch --yes smallrye-sign.asc

# Initialize Git
init-git:
@echo "Git setup"
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "[email protected]"

# Steps before releasing
pre-release: decrypt-secrets init-gpg init-git
@echo "🚀 Pre-release steps..."
@echo "Pre-release verifications"
jbang .build/PreRelease.java --token=${RELEASE_TOKEN} --release-version=${RELEASE_VERSION}
@echo "Bump project version to ${RELEASE_VERSION}"
./mvnw --settings .build/maven-ci-settings.xml --batch-mode --no-transfer-progress versions:set -DnewVersion=${RELEASE_VERSION} -DgenerateBackupPoms=false
./mvnw --settings .build/maven-ci-settings.xml --batch-mode --no-transfer-progress versions:set -DnewVersion=${RELEASE_VERSION} -DgenerateBackupPoms=false -pl bom
jbang .build/UpdateDocsAttributesFiles.java --mutiny-version=${VERSION}
.build/update-workshop-target-version.sh "${VERSION}"
@echo "Check that the project builds (no tests)"
./mvnw --settings maven-settings.xml --batch-mode --no-transfer-progress clean install -Prelease -DskipTests
@echo "Check that the website builds"
[[ ${DEPLOY_WEBSITE} == "true" ]] && cd documentation && pipenv run mkdocs build

# Steps to release
release: pre-release
@echo "🚀 Release steps..."
@echo "Commit release version and push upstream"
git commit -am "chore(release): release Mutiny ${RELEASE_VERSION}"
git push
@echo "Call JReleaser"
./mvnw -settings .build/maven-ci-settings.xml --batch-mode --no-transfer-progress -Pjreleaser jreleaser:full-release -pl :mutiny-project
@echo "Deploy to Maven Central"
./mvnw --settings maven-settings.xml --batch-mode --no-transfer-progress deploy -Prelease -DskipTests
@echo "Bump to 999-SNAPSHOT and push upstream"
./mvnw --settings .build/maven-ci-settings.xml --batch-mode --no-transfer-progress versions:set -DnewVersion=999-SNAPSHOT -DgenerateBackupPoms=false
./mvnw --settings .build/maven-ci-settings.xml --batch-mode --no-transfer-progress versions:set -DnewVersion=999-SNAPSHOT -DgenerateBackupPoms=false -pl bom
git commit -am "chore(release): set development version to 999-SNAPSHOT"
git push

# Steps post-release
post-release:
@echo "🚀 Post-release steps..."
[[ ${CLEAR_REVAPI} == "true" ]] && just -f .build/justfile-for-release -d . clear-revapi
[[ ${DEPLOY_WEBSITE} == "true" ]] && .build/deploy-site.sh

# Clear RevAPI justifications
clear-revapi:
#!/usr/bin/env bash
jbang .build/CompatibilityUtils.java clear --version="${RELEASE_VERSION}" --do-not-clear-version-prefix="1."
if [[ $(git diff --stat) != '' ]]; then
git add -A
git status
git commit -m "chore(release): clear RevAPI breaking change justifications"
git push
else
echo "No justifications cleared"
fi
17 changes: 0 additions & 17 deletions .build/release-with-jreleaser.sh

This file was deleted.

4 changes: 0 additions & 4 deletions .build/setup-git.sh

This file was deleted.

4 changes: 0 additions & 4 deletions .build/setup-jbang.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/build-1.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ jobs:
java-version: 8
cache: maven
- name: Build with Maven
run: ./mvnw -s .build/maven-ci-settings.xml -B clean verify
run: ./mvnw --no-transfer-progress -s .build/maven-ci-settings.xml -B clean verify

2 changes: 1 addition & 1 deletion .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
distribution: temurin
cache: maven
- name: Build with Maven
run: ./mvnw -s .build/maven-ci-settings.xml -B clean verify
run: ./mvnw --no-transfer-progress -s .build/maven-ci-settings.xml -B clean verify
- name: Deploy snapshots
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
19 changes: 5 additions & 14 deletions .github/workflows/build-pull-1.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
runs-on: ubuntu-20.04
name: Build with Java 8
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
name: set up jdk 8
with:
distribution: temurin
Expand All @@ -24,16 +24,7 @@ jobs:
- name: Build with Maven
env:
MAVEN_OPTS: ${{ matrix.java.opts }}
run: ./mvnw -s .build/maven-ci-settings.xml -B clean verify
compatibility:
runs-on: ubuntu-20.04
name: Compatibility Check
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: 8
distribution: temurin
cache: maven
run: ./mvnw --no-transfer-progress -s .build/maven-ci-settings.xml -B clean verify
- name: Compatibility Check
run: ./mvnw -s .build/maven-ci-settings.xml -pl '!bom' -B install revapi:check@check-compatibility -DskipTests -fae
run: ./mvnw --no-transfer-progress -s .build/maven-ci-settings.xml -pl '!bom' -B install revapi:check@check-compatibility -DskipTests -fae

4 changes: 2 additions & 2 deletions .github/workflows/build-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Build with Maven
env:
MAVEN_OPTS: ${{ matrix.java.opts }}
run: ./mvnw -s .build/maven-ci-settings.xml -B clean verify -Pcoverage
run: ./mvnw --no-transfer-progress -s .build/maven-ci-settings.xml -B clean verify -Pcoverage
- name: Codecov
uses: codecov/[email protected]

Expand All @@ -53,4 +53,4 @@ jobs:
distribution: temurin
cache: maven
- name: Compatibility Check
run: ./mvnw -s .build/maven-ci-settings.xml -pl '!bom' -B install revapi:check@check-compatibility -DskipTests -fae
run: ./mvnw --no-transfer-progress -s .build/maven-ci-settings.xml -pl '!bom' -B install revapi:check@check-compatibility -DskipTests -fae
39 changes: 0 additions & 39 deletions .github/workflows/deploy-release.yml

This file was deleted.

6 changes: 4 additions & 2 deletions .github/workflows/deploy-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ jobs:
ref: ${{ github.event.ref }}
token: ${{ secrets.RELEASE_TOKEN }}
fetch-depth: 0 # fetch all commits and branches for mike to work properly
- name: Git setup
run: .build/setup-git.sh
- name: Setup yq (portable yaml processor)
uses: mikefarah/yq@master
- name: Install just
uses: taiki-e/install-action@just
- name: Setup Git
run: just -f .build/justfile-for-release -d . init-git
- name: Setup Python
uses: actions/setup-python@v4
with:
Expand Down
79 changes: 0 additions & 79 deletions .github/workflows/post-release.yml

This file was deleted.

Loading

0 comments on commit 067a095

Please sign in to comment.