Skip to content

Commit

Permalink
Set up release process (#29)
Browse files Browse the repository at this point in the history
Provide a `release.yml` workflow and JReleaser configuration that allows the creation of automatic releases.

Fixes #24
  • Loading branch information
kthoms authored Nov 25, 2024
1 parent feccb36 commit 709c8ff
Show file tree
Hide file tree
Showing 7 changed files with 335 additions and 99 deletions.
16 changes: 16 additions & 0 deletions .github/jreleaser/changelog.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
This project provides an Open Rewrite Recipe to migrate a Camunda 7 Instance to Operaton.

# About this release

This is the first version of the Camunda 7 to Operaton migration recipe.

The project has been set up and most work has been done on build infrastructure.

## New Recipes:

- `org.operaton.rewrite.ReplaceCamundaDependencies`: Replaces the `org.camunda.*` occurrences with `org.operaton.*` dependencies.

## Changelog

{{changelogChanges}}
{{changelogContributors}}
140 changes: 101 additions & 39 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ name: Release
on:
workflow_dispatch:
inputs:
release_branch:
description: 'The branch to release from'
required: true
default: 'main'
next_version:
description: 'The next development version to set (append -SNAPSHOT suffix)'
description: 'The next development version to set (without -SNAPSHOT suffix)'
required: true
dry_run:
description: 'Dry-Run: Skips remote operations when true'
Expand All @@ -16,73 +20,131 @@ jobs:
name: Precheck
runs-on: ubuntu-latest
outputs:
version: ${{ steps.vars.outputs.VERSION }}
version: ${{steps.version.outputs.version}}
is_prerelease: ${{steps.version.outputs.is_prerelease}}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{github.event.inputs.release_branch}}

- name: Version
id: vars
id: version
shell: bash
run: |
RELEASE_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout |tail -n 1 | sed -e 's/-SNAPSHOT//')
echo "RELEASE_VERSION" >> $GITHUB_OUTPUT
echo "⚙ Releasing version $RELEASE_VERSION"
RELEASE_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout | tail -n 1 | sed -e 's/-SNAPSHOT//')
echo "version=$RELEASE_VERSION" >> $GITHUB_OUTPUT
if [[ "$RELEASE_VERSION" == *"alpha"* || "$RELEASE_VERSION" == *"beta"* ]]; then
echo "⚙ Releasing version '$RELEASE_VERSION' (Pre-Release)"
echo "is_prerelease=true" >> $GITHUB_OUTPUT
else
echo "⚙ Releasing version '$RELEASE_VERSION'"
echo "is_prerelease=false" >> $GITHUB_OUTPUT
fi
./mvnw versions:set -DnewVersion=$RELEASE_VERSION
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -a -m "[releng] Releasing version $RELEASE_VERSION"
git push origin main
if ! git diff-index --quiet HEAD --; then
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git commit -am "[releng] Releasing version $RELEASE_VERSION"
git push origin ${{github.event.inputs.release_branch}}
fi
release:
name: Release
release_build:
name: Release Build
needs: precheck
runs-on: ubuntu-latest
outputs:
output1: ${{steps.upload-release-artifacts.outputs.artifact-id}}
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{github.event.inputs.release_branch}}

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
java-version: '17'
distribution: 'temurin'
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
cache: maven

- name: Maven Build
run: ./mvnw clean verify
run: |
./mvnw clean deploy -Prelease -DaltDeploymentRepository=local::file:./target/staging-deploy
# https://slack-chats.kotlinlang.org/t/16407246/anyone-tried-the-https-central-sonatype-org-publish-publish-
find target -name maven-metadata.* -delete
- name: Upload Artifacts
id: upload-release-artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts
path: ./*/staging-deploy/**

release:
name: Release
needs:
- precheck
- release_build
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{github.event.inputs.release_branch}}

- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: release-artifacts

- name: Release with JReleaser
uses: jreleaser/release-action@v2
env:
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.version }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
JRELEASER_DRY_RUN: ${{ github.event.inputs.dry_run }}

- name: Set next development version
run: |
./mvnw versions:set -DnewVersion=${{ github.event.inputs.next_version }}
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -am "[releng] Bump version to ${{ github.event.inputs.next_version }}"
git push origin main
- name: JReleaser release output
JRELEASER_PROJECT_VERSION: ${{needs.precheck.outputs.version}}
JRELEASER_GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
JRELEASER_GPG_PUBLIC_KEY: ${{secrets.GPG_PUBLIC_KEY}}
JRELEASER_GPG_SECRET_KEY: ${{secrets.GPG_PRIVATE_KEY}}
JRELEASER_GPG_PASSPHRASE: ${{secrets.GPG_PASSPHRASE}}
JRELEASER_MAVENCENTRAL_USERNAME: ${{secrets.OSSRH_USERNAME}}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{secrets.OSSRH_PASSWORD}}
JRELEASER_NEXUS2_USERNAME: ${{secrets.OSSRH_USERNAME}}
JRELEASER_NEXUS2_PASSWORD: ${{secrets.OSSRH_PASSWORD}}
JRELEASER_DRY_RUN: ${{github.event.inputs.dry_run}}
JRELEASER_PRERELEASE_ENABLED: ${{needs.precheck.outputs.is_prerelease}}
- name: Upload Build Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: jreleaser-release
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
name: build-artifacts
path: ${{ github.workspace }}/**/**
retention-days: 1

post_release:
name: Post-Release
needs: release
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{github.event.inputs.release_branch}}

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Set next development version
run: |
NEXT_VERSION=${{github.event.inputs.next_version}}-SNAPSHOT
./mvnw versions:set -DnewVersion=$NEXT_VERSION
if ! git diff-index --quiet HEAD --; then
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git commit --allow-empty -am "[releng] Bump version to $NEXT_VERSION"
git push origin ${{github.event.inputs.release_branch}}
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ out/
src/main/generated/
.vscode/
*.iml
/pom.xml.versionsBackup
1 change: 1 addition & 0 deletions .mvn/wrapper/.!94984!maven-wrapper.jar
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PK
Loading

0 comments on commit 709c8ff

Please sign in to comment.