From 98fc480cd0b69a0b2277b0a62b81c7e367224f5a Mon Sep 17 00:00:00 2001 From: Adam DesJardin Date: Fri, 16 Jun 2023 08:59:35 -0500 Subject: [PATCH] build: Adding JReleaser to publishing releases. Updating github actions to use latest versions and new syntax. --- .github/workflows/build.yml | 50 +++++++++++++------- jreleaser.yml | 92 +++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 16 deletions(-) create mode 100644 jreleaser.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1edeae1..0f1e3738 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,12 +19,13 @@ jobs: version: ${{ steps.set-version.outputs.version }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: + fetch-depth: '0' submodules: 'recursive' - name: Set up JDK 1.8 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: adopt-hotspot java-version: 8 @@ -37,7 +38,7 @@ jobs: - name: Set Version id: set-version - run: echo ::set-output name=version::$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) + run: echo version=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) >> $GITHUB_OUTPUT - name: Print Version run: echo "Version ${{ steps.set-version.outputs.version }}" @@ -64,39 +65,56 @@ jobs: OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + - name: JReleaser full-Release + if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}} + uses: jreleaser/release-action@v2 + env: + JRELEASER_PROJECT_VERSION: ${{steps.set-version.outputs.version}} + JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} + JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} + JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }} + JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} + JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }} + JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + JRELEASER_VERSION: 1.6.0 + with: + version: ${{ env.JRELEASER_VERSION }} + arguments: full-release + + - name: JReleaser release output + if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}} + uses: actions/upload-artifact@v3 + with: + name: jreleaser-release + path: | + out/jreleaser/trace.log + out/jreleaser/output.properties + Perform-Release: runs-on: ubuntu-latest needs: Build-and-Publish if: ${{ !contains(needs.Build-and-Publish.outputs.version, 'SNAPSHOT') && github.event_name != 'pull_request' && github.ref == 'refs/heads/master'}} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: + fetch-depth: '0' submodules: 'recursive' - name: Set up JDK 1.8 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: adopt-hotspot java-version: 8 cache: maven - - name: Tag Release - env: - GIT_USER: ${{ secrets.GIT_USER }} - GIT_PASSWORD: ${{ secrets.GIT_TOKEN }} - run: | - git config --global user.email "${{ github.actor }}@users.noreply.github.com" - git config --global user.name "${{ github.actor }}" - git remote set-url origin "https://${{github.actor}}:${{ github.token }}@github.com/${{ github.repository }}.git" - git tag -a "v${{ needs.Build-and-Publish.outputs.version }}" "${{ github.sha }}" -m "Version ${{ needs.Build-and-Publish.outputs.version }}" - git push origin "v${{ needs.Build-and-Publish.outputs.version }}" - name: Increment Version run: | ./mvnw clean build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT -DprocessAllModules versions:commit + - name: Set New Version Variable id: set-new-version - run: echo ::set-output name=version::$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) + run: echo version=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) >> $GITHUB_OUTPUT - name: Create Pull Request uses: peter-evans/create-pull-request@v4 diff --git a/jreleaser.yml b/jreleaser.yml new file mode 100644 index 00000000..5adb6753 --- /dev/null +++ b/jreleaser.yml @@ -0,0 +1,92 @@ +project: + name: mule-deploy + description: Mule Deploy is a library/CLI/Maven plugin that provides full lifecycle deployment of MuleSoft applications and API's + longDescription: | + Mule Deploy is a Java/Groovy based library to handle the deployment and lifecycle management of MuleSoft applications + and API's. It provides a CLI and Maven plugin so that it can be called from existing build tools and CI/CD platforms. + Mule Deploy can deploy applications to CloudHub, CloudHub 2.0, Runtime Fabric and Standalone Mule runtimes. It can + also synchronize API specifications to design center, publish specs from design center to Exchange, and deploy API's + from exchange to API Manager and promote them between environments. It can also handle policy attachment to those API's. + + links: + homepage: https://github.com/avioconsulting/mule-deploy-library + documentation: https://github.com/avioconsulting/mule-deploy-library + license: https://github.com/avioconsulting/mule-deploy-library/blob/main/LICENSE + contribute: https://github.com/avioconsulting/mule-deploy-library/blob/main/README.adoc + authors: + - Adam DesJardin + - Brady Wied + - Tim Gonzales + - Talysson Castro + - Manik Magar + license: BSD-2-Clause + inceptionYear: 2020 + tags: + - mule + java: + groupId: com.avioconsulting.mule + version: 8 + versionPattern: SEMVER + snapshot: + pattern: .*-SNAPSHOT + label: early-access + fullChangelog: true + +release: + github: + owner: 'avioconsulting' + overwrite: true + draft: false + sign: true + releaseName: '{{tagName}}' + skipTag: false + milestone: + close: false + changelog: + skipMergeCommits: true + formatted: ALWAYS + preset: conventional-commits + format: '- {{commitShortHash}} {{commitTitle}}' + contributors: + format: '- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}' + labelers: + - label: 'dependencies' + title: 'chore(deps):' + order: 130 + categories: + - title: '⚙️ Dependencies' + key: 'dependencies' + order: 80 + labels: + - 'dependencies' + hide: + categories: + - 'merge' + contributors: + - 'GitHub' + +checksum: + individual: true + +signing: + active: ALWAYS + armored: true + mode: MEMORY + +#deploy: +# maven: +# nexus2: +# maven-central: +# active: ALWAYS +# url: https://oss.sonatype.org/service/local +# snapshotUrl: https://oss.sonatype.org/content/repositories/snapshots/ +# applyMavenCentralRules: true +# closeRepository: true +# releaseRepository: true +# stagingRepositories: +# - target/staging-deploy + +#distributions: +# mule-health-check-api: +# artifacts: +# - path: target/mule-health-check-api-{{projectVersion}}-mule-plugin.jar \ No newline at end of file