Skip to content

Commit

Permalink
Backport new release process
Browse files Browse the repository at this point in the history
  • Loading branch information
ozangunalp committed Dec 18, 2024
1 parent 8427a52 commit 3b0a017
Show file tree
Hide file tree
Showing 11 changed files with 224 additions and 184 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.24.0
current-version: 4.24.1-RC1
next-version: 999-SNAPSHOT
4 changes: 2 additions & 2 deletions .github/workflows/build-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
pull_request:
branches:
- main
- 3.x
- 3.13.x
- 4.x
- 4.24.x

jobs:
build:
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
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: Java setup
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven

- name: Tools setup
run: |
curl -s "https://get.sdkman.io" | bash
source ~/.sdkman/bin/sdkman-init.sh && sdk install jbang
- 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
shell: bash -ieo pipefail {0}
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
24 changes: 17 additions & 7 deletions .github/workflows/push-deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,54 @@
name: Deploy Docs Smallrye Reactive Messaging
name: Deploy Docs
run-name: Deploy ${{github.event.inputs.version || github.ref_name}} Docs

on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
type: string
workflow_call:

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:
java-version: '17'
java-version: '21'
distribution: 'temurin'
cache: maven

- 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: Set Release Version
run: |
echo "RELEASE_VERSION=${RELEASE_VERSION:-"$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)"}" >> $GITHUB_ENV
- name: Perform the deploy docs
- name: Git user setup
run: |
just build-ci deploy-docs
git config --global user.name "SmallRye CI"
git config --global user.email "smallrye@googlegroups.com"
- name: Perform the deploy docs
run: just build-ci deploy-docs ${{ env.RELEASE_VERSION }}
32 changes: 0 additions & 32 deletions .github/workflows/push-release-to-maven-central.yml

This file was deleted.

82 changes: 27 additions & 55 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,35 @@
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
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.

7 changes: 7 additions & 0 deletions documentation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,13 @@
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Loading

0 comments on commit 3b0a017

Please sign in to comment.