From 9b2b968c56f64c2851fb3831d0fe6e0e8a760c76 Mon Sep 17 00:00:00 2001 From: Ozan Gunalp Date: Tue, 19 Nov 2024 10:27:42 +0100 Subject: [PATCH] New release process --- .github/project.yml | 5 ++ .github/workflows/prepare-release.yml | 63 ++++++++++++++ .github/workflows/push-deploy-docs.yml | 14 +--- .../push-release-to-maven-central.yml | 32 ------- .github/workflows/release.yml | 84 +++++++------------ .github/workflows/review-release.yml | 31 +++++++ RELEASING.md | 29 +++++++ justfile | 57 +------------ pom.xml | 6 ++ 9 files changed, 168 insertions(+), 153 deletions(-) create mode 100644 .github/project.yml create mode 100644 .github/workflows/prepare-release.yml delete mode 100644 .github/workflows/push-release-to-maven-central.yml create mode 100644 .github/workflows/review-release.yml create mode 100644 RELEASING.md diff --git a/.github/project.yml b/.github/project.yml new file mode 100644 index 000000000..8f2d858ff --- /dev/null +++ b/.github/project.yml @@ -0,0 +1,5 @@ +name: SmallRye Reactive Messaging +release: + previous-version: 4.25.0 + current-version: 4.26.0-RC1 + next-version: 999-SNAPSHOT diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 000000000..5d717e23c --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -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 diff --git a/.github/workflows/push-deploy-docs.yml b/.github/workflows/push-deploy-docs.yml index f998c3d64..0963858f5 100644 --- a/.github/workflows/push-deploy-docs.yml +++ b/.github/workflows/push-deploy-docs.yml @@ -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: @@ -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: @@ -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 }} diff --git a/.github/workflows/push-release-to-maven-central.yml b/.github/workflows/push-release-to-maven-central.yml deleted file mode 100644 index 68ddb2467..000000000 --- a/.github/workflows/push-release-to-maven-central.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Push a release to Maven Central - -on: - push: - tags: - - '4.*' - -jobs: - deploy: - runs-on: ubuntu-latest - env: - MAVEN_DEPLOY_USERNAME: ${{ secrets.MAVEN_DEPLOY_USERNAME }} - MAVEN_DEPLOY_TOKEN: ${{ secrets.MAVEN_DEPLOY_TOKEN }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - steps: - - name: Git checkout - uses: actions/checkout@v4 - - name: Java setup - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - cache: maven - server-id: 'oss.sonatype' - server-username: 'MAVEN_DEPLOY_USERNAME' - server-password: 'MAVEN_DEPLOY_TOKEN' - gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - gpg-passphrase: 'MAVEN_GPG_PASSPHRASE' - - name: Install just - uses: taiki-e/install-action@just - - name: Deploy to Maven Central - run: just deploy-to-maven-central diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 891e11139..d9023363c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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}} diff --git a/.github/workflows/review-release.yml b/.github/workflows/review-release.yml new file mode 100644 index 000000000..979051746 --- /dev/null +++ b/.github/workflows/review-release.yml @@ -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}} diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 000000000..64271085f --- /dev/null +++ b/RELEASING.md @@ -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. + diff --git a/justfile b/justfile index 5acd485e9..a404459b7 100755 --- a/justfile +++ b/justfile @@ -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: diff --git a/pom.xml b/pom.xml index df656dc80..e4152d7b7 100644 --- a/pom.xml +++ b/pom.xml @@ -111,6 +111,7 @@ 3.2.3 0.200.0 + 3.1.3 2.1.3 2.0.16 @@ -606,6 +607,11 @@ + + org.apache.maven.plugins + maven-deploy-plugin + ${maven-deploy-plugin.version} + io.smallrye jandex-maven-plugin