-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DATAGO-70348: Publish quarkus to Maven Central (#57)
- Loading branch information
Showing
17 changed files
with
295 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
push: | ||
branches: | ||
- "main" | ||
- 'release/*' | ||
paths-ignore: | ||
- '.gitignore' | ||
- 'CODEOWNERS' | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,163 @@ | ||
name: Quarkiverse Release | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
paths: | ||
- '.github/project.yml' | ||
workflow_dispatch: | ||
inputs: | ||
releaseVersion: | ||
description: "Version to use when preparing a release. Use `auto` to use the latest version from the pom.xml." | ||
required: true | ||
default: "auto" | ||
sourceBranch: | ||
description: "Which branch contains the previous release version." | ||
default: "main" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
group: "quarkiverse-release" | ||
cancel-in-progress: false | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
permissions: | ||
contents: write | ||
packages: write | ||
checks: write | ||
|
||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
name: release | ||
if: ${{github.event.pull_request.merged == true}} | ||
|
||
steps: | ||
- uses: radcortez/project-metadata-action@main | ||
name: Retrieve project metadata | ||
id: metadata | ||
- uses: actions/checkout@v4 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
metadata-file-path: '.github/project.yml' | ||
|
||
- uses: actions/checkout@v3 | ||
ref: ${{ github.event.inputs.sourceBranch }} | ||
|
||
- name: Import GPG key | ||
id: import_gpg | ||
uses: crazy-max/ghaction-import-gpg@v6 | ||
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 #v6.1.0 | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
|
||
passphrase: ${{ secrets.GPG_SECRET }} | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: temurin | ||
java-version: 11 | ||
cache: 'maven' | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
server-id: github | ||
gpg-passphrase: GPG_PASSPHRASE | ||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
|
||
- name: Configure Git author | ||
- name: Find version to use | ||
id: version | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
if [[ "${{ github.event.inputs.releaseVersion }}" -eq "auto" ]]; then | ||
echo "No release version provided, using the latest version from the pom.xml" | ||
new_version=`mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout | sed -e 's/-SNAPSHOT$//'` | ||
echo "New version will be $new_version" | ||
echo version=$new_version >> $GITHUB_OUTPUT | ||
else | ||
echo version=${{ github.event.inputs.releaseVersion }} >> $GITHUB_OUTPUT | ||
fi | ||
- name: Pre-Release Check - Version | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh api --method GET /repos/${{github.repository}}/releases -f sort=updated -f direction=asc > releases.json | ||
release_version_exists=$(jq -r --arg RELEASE_VERSION ${{ steps.version.outputs.version }} '.[].name|select(.|test($RELEASE_VERSION))' releases.json) | ||
if [[ ! -z "$release_version_exists" ]]; then | ||
echo "Version ${{ steps.version.outputs.version }} has been previously released. Please change release version." | ||
exit 1 | ||
else | ||
echo "New version: ${{ steps.version.outputs.version }} going to be released!" | ||
fi | ||
- name: Release Version - Prepare | ||
run: >- | ||
mvn -B -U versions:set | ||
-DnewVersion=${{ steps.version.outputs.version }} | ||
-DprocessAllModules | ||
-DgenerateBackupPoms=false | ||
- name: Update latest release version in docs | ||
run: | | ||
mvn -B -ntp -pl docs -am generate-resources -Denforcer.skip -Dformatter.skip -Dimpsort.skip | ||
if ! git diff --quiet docs/modules/ROOT/pages/includes/attributes.adoc; then | ||
git add docs/modules/ROOT/pages/includes/attributes.adoc | ||
git commit -m "Update the latest release version ${{steps.metadata.outputs.current-version}} in documentation" | ||
fi | ||
- name: Verify Maven | ||
run: mvn verify | ||
|
||
- name: Publishing Test Results - Unit/Integration Tests Pre-Condition | ||
if: always() | ||
id: unit_integration_test_report_exists | ||
uses: andstor/file-existence-action@v2 | ||
with: | ||
files: "**/surefire-reports/**/TEST*.xml" | ||
|
||
- name: Publishing Test Results - Unit/Integration Tests | ||
uses: dorny/[email protected] | ||
if: always() && steps.unit_integration_test_report_exists.outputs.files_exists == 'true' | ||
with: | ||
name: Test Results | ||
path: "**/surefire-reports/**/TEST*.xml" | ||
fail-on-error: 'false' | ||
reporter: java-junit | ||
only-summary: 'true' | ||
|
||
- name: Configure Git author | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
- name: Maven release ${{steps.metadata.outputs.current-version}} | ||
- name: Release Version - Checkin | ||
run: >- | ||
mvn validate | ||
scm:checkin | ||
-DscmVersion=${{ github.event.inputs.sourceBranch }} | ||
-DscmVersionType=branch | ||
-Dmessage="[ci skip] prepare release ${{ steps.version.outputs.version }}" && | ||
mvn scm:tag -Dtag=${{ steps.version.outputs.version }} | ||
- name: GitHub Packages - Deploy Artifacts | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_SECRET }} | ||
run: | | ||
mvn -B release:prepare -Prelease -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}} | ||
mvn -B release:perform -Darguments=-DperformRelease -DperformRelease -Prelease | ||
mvn deploy -Dmaven.install.skip=true -Pgithub,publish | ||
- name: maven-settings-xml-action | ||
uses: whelk-io/maven-settings-xml-action@v4 | ||
with: | ||
servers: '[{ "id": "ossrh", "username": "${{ secrets.OSSRH_USER }}", "password": "${{ secrets.OSSRH_PASS }}" }]' | ||
|
||
- name: Maven Central - Deploy Artifacts | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | ||
|
||
- name: Push changes to ${{github.base_ref}} branch | ||
GPG_PASSPHRASE: ${{ secrets.GPG_SECRET }} | ||
run: | | ||
git push | ||
git push origin ${{steps.metadata.outputs.current-version}} | ||
mvn deploy -Dmaven.install.skip=true -Possrh,publish | ||
- name: Create GitHub Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: "${{ steps.version.outputs.version }}" | ||
generateReleaseNotes: true | ||
makeLatest: true | ||
|
||
- name: Next Develoment Version - Prepare and Checkin | ||
run: >- | ||
mvn -B -U build-helper:parse-version versions:set | ||
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT | ||
-DprocessAllModules | ||
-DgenerateBackupPoms=false && | ||
mvn validate scm:checkin | ||
-DscmVersion=${{ github.event.inputs.sourceBranch }} | ||
-DscmVersionType=branch | ||
-Dmessage="[ci skip] prepare for next development iteration" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Solace-Quarkus CD | ||
There is a github actions 'Quarkiverse Release' workflow, which will perform the following actions | ||
- Update and commit POMs to be a release version (eg `1.0.1` vs `1.0.1-SNAPSHOT`) | ||
- Updates the versions within the docs as well | ||
- The version can be explicitly set, or `auto` will use what is currently on the branch, and can be used for easily publishing incremental patch releases. | ||
- Perform a deploy, skipping tests, to both github packages, and ossrh | ||
- Tag, and create a release on github for this commit | ||
- Increment the minor version of all POMs and re-append `-SNAPSHOT`, (eg `1.0.2-SNAPSHOT`) | ||
|
||
## Workflows Supported | ||
### Trunk Based (main) | ||
Merge a feature branch to main. This branch should be updated from main and have all tests passing. Once in main, run the release workflow | ||
- Use the `auto` release version if this only requires a patch version bump, otherwise set an appropriate version | ||
|
||
### Release branch | ||
In the following depiction of main, trunk based would no longer work if the 1.0 release version need to be maintained with further patch releases | ||
``` | ||
[#7fe6b95 Merge Feature branch PR #5] origin/main | ||
[#7a5bde8 [ci skip] prepare for next development iteration ] | ||
[#5ceb311 [ci skip] prepare release 2.0.0] <- Release Quarkiverse action run with releaseVersion=2.0.0 | ||
[#5923308 Merge Feature branch PR #4 (Major overhaul)] | ||
[#a46a01a [ci skip] prepare for next development iteration ] | ||
[#e354653 [ci skip] prepare release 1.0.1] | ||
[#3923407 Merge Feature branch PR #3] | ||
[#d76a91b [ci skip] prepare for next development iteration ] | ||
[#f85455c [ci skip] prepare release 1.0.0] | ||
[#7d2115f init] | ||
``` | ||
In this case, `git checkout -b release/1.0 a46a01a && git push` This is the sha of the last commit that belongs in this release branch, in this case, the commit setting the version to `1.0.2-SNAPSHOT` | ||
Now the same release workflow can be run, but with `sourceBranch=release/1.0`, and the 2 CI commits will land on the release branch instead of main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
:project-version: 0 | ||
:project-version: ${release.current-version} | ||
|
||
:examples-dir: ./../examples/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.