diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16f6ff8..e4d2f93 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,7 @@ on: push: branches: - "main" + - 'release/*' paths-ignore: - '.gitignore' - 'CODEOWNERS' diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml deleted file mode 100644 index 0a9e64e..0000000 --- a/.github/workflows/pre-release.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Quarkiverse Pre Release - -on: - pull_request: - paths: - - '.github/project.yml' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -defaults: - run: - shell: bash - -jobs: - release: - runs-on: ubuntu-latest - name: pre release - - steps: - - uses: radcortez/project-metadata-action@master - name: retrieve project metadata - id: metadata - 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 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0a3894f..4008010 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,74 +1,142 @@ 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 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: Find version to use + id: version + run: | + 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: Configure Git author run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" + + + - 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: 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 -DskipTests -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 -DskipTests -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" + + diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..4fb5d94 --- /dev/null +++ b/RELEASE.md @@ -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 \ No newline at end of file diff --git a/docs/modules/ROOT/pages/includes/attributes.adoc b/docs/modules/ROOT/pages/includes/attributes.adoc index 19a687e..e1a2881 100644 --- a/docs/modules/ROOT/pages/includes/attributes.adoc +++ b/docs/modules/ROOT/pages/includes/attributes.adoc @@ -1,3 +1,3 @@ -:project-version: 0 +:project-version: ${release.current-version} :examples-dir: ./../examples/ \ No newline at end of file diff --git a/docs/pom.xml b/docs/pom.xml index f8f93d2..f7c695d 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -6,13 +6,13 @@ com.solace.quarkus quarkus-solace-parent - 999-SNAPSHOT + 0.0.1-SNAPSHOT ../pom.xml quarkus-solace-docs Quarkus Solace - Documentation - + 0.0.1-SNAPSHOT @@ -41,23 +41,6 @@ - - it.ozimov - yaml-properties-maven-plugin - - - initialize - - read-project-properties - - - - ${project.basedir}/../.github/project.yml - - - - - maven-resources-plugin diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 548e664..1c0c877 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -4,10 +4,11 @@ com.solace.quarkus quarkus-solace-parent - 999-SNAPSHOT + 0.0.1-SNAPSHOT quarkus-solace-integration-tests-parent Quarkus Solace - Integration Tests - Parent + pom solace-client-integration-tests diff --git a/integration-tests/solace-client-integration-tests/pom.xml b/integration-tests/solace-client-integration-tests/pom.xml index 7230dd5..e896c52 100644 --- a/integration-tests/solace-client-integration-tests/pom.xml +++ b/integration-tests/solace-client-integration-tests/pom.xml @@ -7,7 +7,7 @@ com.solace.quarkus quarkus-solace-integration-tests-parent - 999-SNAPSHOT + 0.0.1-SNAPSHOT solace-client-integration-tests diff --git a/pom.xml b/pom.xml index 39ca21a..ac39e69 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,8 @@ - + 4.0.0 io.quarkiverse @@ -9,23 +11,14 @@ com.solace.quarkus quarkus-solace-parent - 999-SNAPSHOT + 0.0.1-SNAPSHOT pom Quarkus Solace - Parent - - quarkus-solace-client - quarkus-solace-messaging-connector - docs - samples/hello-solace - samples/hello-connector-solace - integration-tests - - - scm:git:git@github.com:SolaceCoEExt/solace-quarkus.git - scm:git:git@github.com:SolaceCoEExt/solace-quarkus.git - https://github.com/SolaceCoEExt/solace-quarkus + scm:git:https://github.com/SolaceDev/solace-quarkus-ci-dev.git + scm:git:https://github.com/SolaceDev/solace-quarkus-ci-dev.git + https://github.com/SolaceDev/solace-quarkus-ci-dev @@ -106,5 +99,124 @@ + + + org.codehaus.mojo + build-helper-maven-plugin + + + parse-version + + parse-version + + + + + - + + + + development + + true + + + quarkus-solace-client + quarkus-solace-messaging-connector + docs + samples/hello-solace + samples/hello-connector-solace + integration-tests + + + + publish + + quarkus-solace-client + quarkus-solace-messaging-connector + docs + + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.1.0 + + + sign-artifacts + verify + + sign + + + + + --pinentry-mode + loopback + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.0 + + true + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + + + + + github + + true + + + + github + https://maven.pkg.github.com/SolaceDev/solace-quarkus-ci-dev + + + github + https://maven.pkg.github.com/SolaceDev/solace-quarkus-ci-dev + + + + + ossrh + + + + org.sonatype.plugins + nexus-staging-maven-plugin + true + + ossrh + https://s01.oss.sonatype.org/ + false + false + + + + + + + \ No newline at end of file diff --git a/quarkus-solace-client/deployment/pom.xml b/quarkus-solace-client/deployment/pom.xml index 6fa3f55..b9639e6 100644 --- a/quarkus-solace-client/deployment/pom.xml +++ b/quarkus-solace-client/deployment/pom.xml @@ -5,7 +5,7 @@ com.solace.quarkus quarkus-solace-client-parent - 999-SNAPSHOT + 0.0.1-SNAPSHOT quarkus-solace-client-deployment Quarkus Solace Client - Deployment diff --git a/quarkus-solace-client/pom.xml b/quarkus-solace-client/pom.xml index 4360b55..2b39457 100644 --- a/quarkus-solace-client/pom.xml +++ b/quarkus-solace-client/pom.xml @@ -6,7 +6,7 @@ com.solace.quarkus quarkus-solace-parent - 999-SNAPSHOT + 0.0.1-SNAPSHOT quarkus-solace-client-parent Quarkus Solace Client - Parent diff --git a/quarkus-solace-client/runtime/pom.xml b/quarkus-solace-client/runtime/pom.xml index f8f61ce..3e68551 100644 --- a/quarkus-solace-client/runtime/pom.xml +++ b/quarkus-solace-client/runtime/pom.xml @@ -5,7 +5,7 @@ com.solace.quarkus quarkus-solace-client-parent - 999-SNAPSHOT + 0.0.1-SNAPSHOT quarkus-solace-client Quarkus Solace Client - Runtime diff --git a/quarkus-solace-messaging-connector/deployment/pom.xml b/quarkus-solace-messaging-connector/deployment/pom.xml index bdea0cb..1818b41 100644 --- a/quarkus-solace-messaging-connector/deployment/pom.xml +++ b/quarkus-solace-messaging-connector/deployment/pom.xml @@ -5,7 +5,7 @@ com.solace.quarkus quarkus-solace-messaging-connector-parent - 999-SNAPSHOT + 0.0.1-SNAPSHOT quarkus-solace-messaging-connector-deployment Quarkus Solace Messaging Connector - Deployment diff --git a/quarkus-solace-messaging-connector/pom.xml b/quarkus-solace-messaging-connector/pom.xml index 1ffdd58..9bfc954 100644 --- a/quarkus-solace-messaging-connector/pom.xml +++ b/quarkus-solace-messaging-connector/pom.xml @@ -5,7 +5,7 @@ com.solace.quarkus quarkus-solace-parent - 999-SNAPSHOT + 0.0.1-SNAPSHOT quarkus-solace-messaging-connector-parent Quarkus Solace Messaging Connector - Parent diff --git a/quarkus-solace-messaging-connector/runtime/pom.xml b/quarkus-solace-messaging-connector/runtime/pom.xml index 6246485..45c1b5c 100644 --- a/quarkus-solace-messaging-connector/runtime/pom.xml +++ b/quarkus-solace-messaging-connector/runtime/pom.xml @@ -6,7 +6,7 @@ com.solace.quarkus quarkus-solace-messaging-connector-parent - 999-SNAPSHOT + 0.0.1-SNAPSHOT quarkus-solace-messaging-connector Quarkus Solace Messaging Connector - Runtime diff --git a/samples/hello-connector-solace/pom.xml b/samples/hello-connector-solace/pom.xml index 2cfe197..9a06131 100644 --- a/samples/hello-connector-solace/pom.xml +++ b/samples/hello-connector-solace/pom.xml @@ -5,7 +5,7 @@ com.solace.quarkus quarkus-solace-parent - 999-SNAPSHOT + 0.0.1-SNAPSHOT ../../pom.xml quarkus-solace-sample-connector-hello diff --git a/samples/hello-solace/pom.xml b/samples/hello-solace/pom.xml index 640cdc1..4740ba3 100644 --- a/samples/hello-solace/pom.xml +++ b/samples/hello-solace/pom.xml @@ -5,7 +5,7 @@ com.solace.quarkus quarkus-solace-parent - 999-SNAPSHOT + 0.0.1-SNAPSHOT ../../pom.xml quarkus-solace-sample-hello