Skip to content

Commit

Permalink
Merge pull request #2852 from ozangunalp/new_release_process
Browse files Browse the repository at this point in the history
New release process
  • Loading branch information
ozangunalp authored Dec 16, 2024
2 parents 71f672e + 9b2b968 commit 1310355
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 153 deletions.
5 changes: 5 additions & 0 deletions .github/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: SmallRye Reactive Messaging
release:
previous-version: 4.25.0
current-version: 4.26.0-RC1
next-version: 999-SNAPSHOT
63 changes: 63 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Prepare Release

on:
pull_request:
types:
- closed
paths:
- '.github/project.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
prepare-release:
name: Prepare Release
if: ${{ github.event.pull_request.merged == true}}
uses: smallrye/.github/.github/workflows/prepare-release.yml@main
secrets: inherit

after-release:
name: After release
needs: prepare-release
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged == true}}

steps:
- name: Create GitHub App Token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.CI_APP_ID }}
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
token: ${{steps.app-token.outputs.token}}

- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}

- name: Configure Git author
run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
- name: Update files
run: |
echo "✅ Clear RevAPI justifications, if any"
jbang .build/CompatibilityUtils.java clear
if [[ $(git diff --stat) != '' ]]; then
git add -A
git status
git commit -m "[POST-RELEASE] - Clearing breaking change justifications"
git push
else
echo "No justifications cleared"
fi
14 changes: 3 additions & 11 deletions .github/workflows/push-deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Deploy Docs Smallrye Reactive Messaging
name: Deploy Docs
run-name: Deploy ${{github.event.inputs.version || github.ref_name}} Docs

on:
workflow_dispatch:
Expand All @@ -9,17 +10,12 @@ on:
jobs:
deploy-docs:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
RELEASE_VERSION: ${{ github.event.inputs.version }}

steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_TOKEN }}
- name: Java setup
uses: actions/setup-java@v4
with:
Expand All @@ -36,9 +32,5 @@ jobs:
cache-dependency-path: documentation/Pipfile.lock
- name: Install pipenv
run: pip install pipenv
- name: Set Release Version
run: |
echo "RELEASE_VERSION=${RELEASE_VERSION:-"$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)"}" >> $GITHUB_ENV
- name: Perform the deploy docs
run: |
just build-ci deploy-docs
run: just build-ci deploy-docs ${{ github.event.inputs.version }}
32 changes: 0 additions & 32 deletions .github/workflows/push-release-to-maven-central.yml

This file was deleted.

84 changes: 29 additions & 55 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,37 @@
name: Release Smallrye Reactive Messaging
name: Release
run-name: Perform ${{github.event.inputs.tag || github.ref_name}} Release

on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
previousVersion:
description: 'Previous version'
tag:
description: 'Tag to release'
required: true
version:
description: 'Release version'
required: true
deployWebsite:
description: 'Shall we deploy the website?'
required: true
default: 'true'
clearRevAPI:
description: 'Shall we clear RevAPI justifications?'
required: true
default: 'true'

permissions:
attestations: write
id-token: write
# Needed for the publish-* workflows
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
RELEASE_VERSION: ${{ github.event.inputs.version }}
DEPLOY_WEBSITE: ${{ github.event.inputs.deployWebsite }}
CLEAR_REVAPI: ${{ github.event.inputs.clearRevAPI }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
JRELEASER_TAG_NAME: ${{ github.event.inputs.version }}
JRELEASER_PREVIOUS_TAG_NAME: ${{ github.event.inputs.previousVersion }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
perform-release:
name: Perform Release
uses: smallrye/.github/.github/workflows/perform-release.yml@main
secrets: inherit
with:
version: ${{github.event.inputs.tag || github.ref_name}}

steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_TOKEN }}
- name: Java setup
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: 'MAVEN_GPG_PASSPHRASE'
- name: Install just
uses: taiki-e/install-action@just
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: 'pipenv'
cache-dependency-path: documentation/Pipfile.lock
- name: Install pipenv
run: pip install pipenv
- name: Perform the release steps
run: |
curl -s "https://get.sdkman.io?rcupdate=false" | bash
source ~/.sdkman/bin/sdkman-init.sh && sdk install jbang
just perform-release
deploy-site:
name: GitHub Pages
needs: perform-release
uses: ./.github/workflows/push-deploy-docs.yml
with:
version: ${{github.event.inputs.tag || github.ref_name}}
31 changes: 31 additions & 0 deletions .github/workflows/review-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Review Release

on:
pull_request:
paths:
- '.github/project.yml'

jobs:
review-release:
name: Review release
runs-on: ubuntu-latest

steps:
- name: Retrieve project metadata
id: metadata
uses: radcortez/project-metadata-action@main
with:
github-token: ${{secrets.GITHUB_TOKEN}}
metadata-file-path: '.github/project.yml'

- name: Validate version
if: contains(steps.metadata.outputs.current-version, 'SNAPSHOT')
run: |
echo '::error::Cannot release a SNAPSHOT version.'
exit 1
- name: Milestone review
uses: radcortez/milestone-review-action@main
with:
github-token: ${{secrets.GITHUB_TOKEN}}
milestone-title: ${{steps.metadata.outputs.current-version}}
29 changes: 29 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Releasing SmallRye Reactive Messaging

The release process starts by creating PR with a release branch.

The release branch contains a change to `.github/project.yml` setting the `current-version` to the release version.

## Review the release PR

On creation the release PR is verified for the `current-version` and whether the milestone contains any open issues or PRs.

## Prepare the release

Once the release PR is merged, the prepare release workflow is triggered.

This workflow calls the maven-release-plugin prepare goal, which sets the release version in the `pom.xml` and pushes a release tag to the repository.

It also closes the milestone associated with the release.

Then the workflow clears any RevAPI justifications and pushes the changes to the target branch (main in regular releases).

## Perform the release

The release workflow is triggered on a push of a new tag (created by the prepare step).

It deploys artifacts locally and attaches them to the action artifacts.
And publishes artifacts to the Maven Central using the Smallrye Release workflow.

When the Maven Central sync is complete, it deploys the website.

57 changes: 2 additions & 55 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,72 +24,19 @@ build-ci:
test-ci:
./mvnw -B -ntp -s .build/ci-maven-settings.xml clean verify

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

# Initialize Git
init-git:
@echo "🔀 Git setup"
git config --global user.name "smallrye-ci"
git config --global user.email "smallrye@googlegroups.com"

# Steps before releasing
pre-release: init-git
@echo "🚀 Pre-release steps..."
@if [[ -z "${RELEASE_TOKEN}" ]]; then exit 1; fi
@if [[ -z "${RELEASE_VERSION}" ]]; then exit 1; fi
@echo "Pre-release verifications"
jbang .build/PreRelease.java --token=${RELEASE_TOKEN} --release-version=${RELEASE_VERSION}
@echo "Bump project version to ${RELEASE_VERSION}"
./mvnw -B -ntp versions:set -DnewVersion=${RELEASE_VERSION} -DgenerateBackupPoms=false
@echo "Check that the project builds (no tests)"
./mvnw -B -ntp clean install -Prelease -DskipTests
@echo "Check that the website builds"
-[[ ${DEPLOY_WEBSITE} == "true" ]] && cd documentation && pipenv install && pipenv run mkdocs build

# Steps to release
release: pre-release
@echo "🚀 Release steps..."
@if [[ -z "${JRELEASER_TAG_NAME}" ]]; then exit 1; fi
@if [[ -z "${JRELEASER_PREVIOUS_TAG_NAME}" ]]; then exit 1; fi
@if [[ -z "${JRELEASER_GITHUB_TOKEN}" ]]; then exit 1; fi
@echo "Commit release version and push upstream"
git commit -am "[RELEASE] - Bump version to ${RELEASE_VERSION}"
git push
jbang .build/CompatibilityUtils.java extract
@echo "Call JReleaser"
./mvnw -B -ntp jreleaser:full-release -Pjreleaser -pl :smallrye-reactive-messaging
-[[ ${DEPLOY_WEBSITE} == "true" ]] && just deploy-docs
@echo "Bump to 999-SNAPSHOT and push upstream"
./mvnw -B -ntp versions:set -DnewVersion=999-SNAPSHOT -DgenerateBackupPoms=false
git commit -am "[RELEASE] - Next development version: 999-SNAPSHOT"
git push

# Deploy to Maven Central
deploy-to-maven-central:
@echo "🔖 Deploy to Maven Central"
./mvnw -B -ntp deploy -Prelease -DskipTests

# Steps post-release
post-release:
@echo "🚀 Post-release steps..."
-[[ ${CLEAR_REVAPI} == "true" ]] && just clear-revapi

# Update Pulsar Connector Configuration Documentation
update-pulsar-config-docs:
@echo "📝 Updating Pulsar connector configuration docs"
jbang .build/PulsarConfigDoc.java -d documentation/src/main/docs/pulsar/config

# Deploy documentation
deploy-docs:
deploy-docs version:
#!/usr/bin/env bash
echo "📝 Deploying documentation to GitHub"
if [[ -z "${RELEASE_VERSION}" ]]; then exit 1; fi
./mvnw -B -ntp clean compile -pl documentation
cd documentation
pipenv install
pipenv run mike deploy --update-aliases --push --remote origin "${RELEASE_VERSION}" "latest"
pipenv run mike deploy --update-aliases --push --remote origin {{version}} "latest"
# Clear RevAPI justifications
clear-revapi:
Expand Down
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@

<jandex-maven-plugin.version>3.2.3</jandex-maven-plugin.version>
<sundr-maven-plugin.version>0.200.0</sundr-maven-plugin.version>
<maven-deploy-plugin.version>3.1.3</maven-deploy-plugin.version>

<nats-embedded.version>2.1.3</nats-embedded.version>
<slf4j-log4j12.version>2.0.16</slf4j-log4j12.version>
Expand Down Expand Up @@ -606,6 +607,11 @@
</pluginManagement>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
</plugin>
<plugin>
<groupId>io.smallrye</groupId>
<artifactId>jandex-maven-plugin</artifactId>
Expand Down

0 comments on commit 1310355

Please sign in to comment.