From c6f90c2ab6d40dd3c835b1fdd3d34c45436cf4d9 Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Tue, 12 Sep 2023 16:13:55 +0200 Subject: [PATCH 01/17] feat: Configuring GHA workflow for dotcli release. --- .github/workflows/cli-release-process.yml | 89 +++++++++++++++++++++++ pom.xml | 1 + tools/dotcms-cli/jreleaser.yml | 52 +++++++++++++ tools/dotcms-cli/pom.xml | 20 +++++ 4 files changed, 162 insertions(+) create mode 100644 .github/workflows/cli-release-process.yml create mode 100644 tools/dotcms-cli/jreleaser.yml diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml new file mode 100644 index 000000000000..3fd4572511bb --- /dev/null +++ b/.github/workflows/cli-release-process.yml @@ -0,0 +1,89 @@ +name: CLI Release + +on: + workflow_dispatch: + inputs: + version: + description: 'Release version' + required: true + branch: + description: 'Branch to cut from' + required: true + default: 25951-implement-gha-generate-cli-release +# default: master + dry_run: + description: 'Dry run' + required: false + default: false +env: + JAVA_VERSION: 11 + JAVA_DISTRO: corretto + +jobs: + precheck: + name: Pre-check + runs-on: ubuntu-latest + outputs: + VERSION: ${{ steps.vars.outputs.version }} + BRANCH: ${{ steps.vars.outputs.branch }} + DRY_RUN: ${{ github.event.inputs.dry_run }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Version + id: vars + shell: bash + run: | + VERSION=${{ github.event.inputs.version }} + BRANCH=${{ github.event.inputs.branch }} + ./mvnw -B versions:set versions:commit -DnewVersion=$VERSION + git config --global user.name "GitHub Action" + git commit -a -m "Releasing version $VERSION" + git push origin "$BRANCH" + + release: + needs: [ precheck ] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: main + fetch-depth: 0 + + - name: Setup Java + uses: actions/setup-java@v3 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: ${{ env.JAVA_DISTRO }} + + - name: Cache Maven + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Prepare dotCMS license + env: + DOTCMS_LICENSE_KEY: ${{ secrets.DOTCMS_LICENSE }} + run: | + DOTCMS_LICENSE_PATH=${GITHUB_WORKSPACE}/tools/dotcms-cli/license + mkdir -p ${DOTCMS_LICENSE_PATH} + echo "${DOTCMS_LICENSE_KEY}" > ${DOTCMS_LICENSE_PATH}/license.dat + echo "DOTCMS_LICENSE_FILE=${DOTCMS_LICENSE_PATH}/license.dat" >> "$GITHUB_ENV" + + - name: Build + working-directory: ${{ github.workspace }}/tools/dotcms-cli + run: | + ./mvnw -U clean install -DskipTests + ./mvnw package -Dquarkus.package.type=uber-jar -DskipTests + + - name: Releaser + env: + JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }} + working-directory: ${{ github.workspace }} + run: | + tools/dotcms-cli/mvnw -Prelease jreleaser:release -Djreleaser.git.root.search=true -pl :dotCMS-cli -Djreleaser.dry.run=${{ needs.precheck.outputs.DRY_RUN }} diff --git a/pom.xml b/pom.xml index ae82a77f7ba8..29389fe590e4 100644 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,7 @@ dotcms-integration plugins-core reports + tools/dotcms-cli diff --git a/tools/dotcms-cli/jreleaser.yml b/tools/dotcms-cli/jreleaser.yml new file mode 100644 index 000000000000..a4a9aee92b18 --- /dev/null +++ b/tools/dotcms-cli/jreleaser.yml @@ -0,0 +1,52 @@ +# Generated with JReleaser 1.8.0 at 2023-09-05T09:49:01.355976+02:00 +project: + name: dotcms-cli + description: app -- DotCMS CLI + longDescription: app -- DotCMS Quarkus CLI application + versionPattern: 'CUSTOM' + java: + multiProject: true + copyright: | +

© 2021 dotCMS Inc. All rights reserved.

+

dotCMS is a registered trademark of dotCMS Inc.

+

dotCMS is licensed under Apache License 2.0.

+

For details, see https://dotcms.com/legal

+ license: Apache-2.0 + authors: + - dotCMS + links: + homepage: https://dotcms.com + documentation: https://dotcms.com/docs/latest + +release: + github: + tagName: 'dotcli{{projectVersion}}' + releaseName: 'DOTCLI - {{projectVersion}}' + overwrite: false + changelog: + formatted: ALWAYS + format: '- {{commitShortHash}} {{commitTitle}}' + preset: conventional-commits + contributors: + format: '- {{contributorName}}' + hide: + categories: + - merge + contributors: + - GitHub + - dependabot + +distributions: + dotcms-cli: + type: SINGLE_JAR + active: ALWAYS + stereotype: CLI + artifacts: + - path: tools/dotcms-cli/cli/target/cli-{{projectVersion}}-runner.jar + transform: tools/dotcms-cli/cli/target/dotcli-{{projectVersion}}.jar + +packagers: + brew: + active: ALWAYS + continueOnError: false + multiPlatform: true diff --git a/tools/dotcms-cli/pom.xml b/tools/dotcms-cli/pom.xml index 43986d763921..365243ae0aac 100644 --- a/tools/dotcms-cli/pom.xml +++ b/tools/dotcms-cli/pom.xml @@ -20,6 +20,7 @@ io.quarkus.platform 2.9.1.Final 3.0.0-M5 + 1.8.0 @@ -48,4 +49,23 @@ + + + release + + + + org.jreleaser + jreleaser-maven-plugin + ${jreleaser-plugin.version} + false + + true + ${project.basedir}/jreleaser.yml + + + + + + From 44174f3af2cc4331673566e92e28ce83bf08735f Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Wed, 13 Sep 2023 10:26:25 +0200 Subject: [PATCH 02/17] feat: Testing GHA workflow cli release --- .github/workflows/cli-release-process.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml index 3fd4572511bb..9655409c164d 100644 --- a/.github/workflows/cli-release-process.yml +++ b/.github/workflows/cli-release-process.yml @@ -1,6 +1,10 @@ name: CLI Release on: + pull_request: + branches: + - master + - release-* workflow_dispatch: inputs: version: @@ -35,8 +39,8 @@ jobs: id: vars shell: bash run: | - VERSION=${{ github.event.inputs.version }} - BRANCH=${{ github.event.inputs.branch }} + VERSION=${{ github.event.inputs.version || '1.1.0-SNAPSHOT' }} + BRANCH=${{ github.event.inputs.branch || '25951-implement-gha-generate-cli-release' }} ./mvnw -B versions:set versions:commit -DnewVersion=$VERSION git config --global user.name "GitHub Action" git commit -a -m "Releasing version $VERSION" @@ -86,4 +90,4 @@ jobs: JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }} working-directory: ${{ github.workspace }} run: | - tools/dotcms-cli/mvnw -Prelease jreleaser:release -Djreleaser.git.root.search=true -pl :dotCMS-cli -Djreleaser.dry.run=${{ needs.precheck.outputs.DRY_RUN }} + tools/dotcms-cli/mvnw -Prelease jreleaser:release -Djreleaser.git.root.search=true -pl :dotCMS-cli -Djreleaser.dry.run=${{ github.event.inputs.dry_run || true }} From 214104bbd4ece04f7d2a01f5bdd09c6f8872bffb Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Wed, 13 Sep 2023 10:46:11 +0200 Subject: [PATCH 03/17] feat: Testing GHA workflow cli release.+1 --- .github/workflows/cli-release-process.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml index 9655409c164d..2f9c7bb4b81e 100644 --- a/.github/workflows/cli-release-process.yml +++ b/.github/workflows/cli-release-process.yml @@ -21,7 +21,7 @@ on: default: false env: JAVA_VERSION: 11 - JAVA_DISTRO: corretto + JAVA_DISTRO: temurin jobs: precheck: @@ -37,6 +37,7 @@ jobs: - name: Version id: vars + working-directory: ${{ github.workspace }}/tools/dotcms-cli shell: bash run: | VERSION=${{ github.event.inputs.version || '1.1.0-SNAPSHOT' }} From 629a7013e9db01d003a19de2db99678df4ef148a Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Wed, 13 Sep 2023 11:11:58 +0200 Subject: [PATCH 04/17] feat(cli): Testing GHA workflow cli release. Listing local branches. --- .github/workflows/cli-release-process.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml index 2f9c7bb4b81e..b49afc82e6f2 100644 --- a/.github/workflows/cli-release-process.yml +++ b/.github/workflows/cli-release-process.yml @@ -43,8 +43,9 @@ jobs: VERSION=${{ github.event.inputs.version || '1.1.0-SNAPSHOT' }} BRANCH=${{ github.event.inputs.branch || '25951-implement-gha-generate-cli-release' }} ./mvnw -B versions:set versions:commit -DnewVersion=$VERSION - git config --global user.name "GitHub Action" + git config --global user.name "dcolina" git commit -a -m "Releasing version $VERSION" + git branch -b git push origin "$BRANCH" release: From 4002d8096eabdba2b2d0d701aaadd53f73850475 Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Wed, 13 Sep 2023 11:17:54 +0200 Subject: [PATCH 05/17] fix(cli): Testing GHA workflow cli release. Listing local branches. --- .github/workflows/cli-release-process.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml index b49afc82e6f2..789eb086d47f 100644 --- a/.github/workflows/cli-release-process.yml +++ b/.github/workflows/cli-release-process.yml @@ -45,7 +45,7 @@ jobs: ./mvnw -B versions:set versions:commit -DnewVersion=$VERSION git config --global user.name "dcolina" git commit -a -m "Releasing version $VERSION" - git branch -b + git branch -l git push origin "$BRANCH" release: From 9debe5ea0fd53abbda03e8ecf95f5a4608e58420 Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Wed, 13 Sep 2023 11:42:28 +0200 Subject: [PATCH 06/17] fix(cli): Testing GHA workflow cli release. Listing local branches. +1. --- .github/workflows/cli-release-process.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml index 789eb086d47f..5cacfce5e4d8 100644 --- a/.github/workflows/cli-release-process.yml +++ b/.github/workflows/cli-release-process.yml @@ -46,6 +46,7 @@ jobs: git config --global user.name "dcolina" git commit -a -m "Releasing version $VERSION" git branch -l + echo "BRANCH=$GITHUB_REF_NAME" git push origin "$BRANCH" release: From dde1c79bf17a3a4c802e6c2ba33baca767373fb4 Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Wed, 13 Sep 2023 11:49:35 +0200 Subject: [PATCH 07/17] fix(cli): Testing GHA workflow cli release. Listing local branches. +2. --- .github/workflows/cli-release-process.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml index 5cacfce5e4d8..8649cc6ae6b4 100644 --- a/.github/workflows/cli-release-process.yml +++ b/.github/workflows/cli-release-process.yml @@ -17,8 +17,8 @@ on: # default: master dry_run: description: 'Dry run' - required: false - default: false + required: true + default: true env: JAVA_VERSION: 11 JAVA_DISTRO: temurin @@ -41,12 +41,14 @@ jobs: shell: bash run: | VERSION=${{ github.event.inputs.version || '1.1.0-SNAPSHOT' }} - BRANCH=${{ github.event.inputs.branch || '25951-implement-gha-generate-cli-release' }} + BRANCH=${{ github.event.inputs.branch || $GITHUB_REF_NAME }} + ./mvnw -B versions:set versions:commit -DnewVersion=$VERSION + git config --global user.name "dcolina" + git config --global user.email "daniel.colina@dotcms.com" + git branch -b $BRANCH git commit -a -m "Releasing version $VERSION" - git branch -l - echo "BRANCH=$GITHUB_REF_NAME" git push origin "$BRANCH" release: From 9568ba3a65b9867fb2cee830bf36c433767096c4 Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Wed, 13 Sep 2023 12:03:37 +0200 Subject: [PATCH 08/17] fix(cli): Testing GHA workflow cli release. Listing local branches. +3. --- .github/workflows/cli-release-process.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml index 8649cc6ae6b4..f6af0ce5bade 100644 --- a/.github/workflows/cli-release-process.yml +++ b/.github/workflows/cli-release-process.yml @@ -41,7 +41,7 @@ jobs: shell: bash run: | VERSION=${{ github.event.inputs.version || '1.1.0-SNAPSHOT' }} - BRANCH=${{ github.event.inputs.branch || $GITHUB_REF_NAME }} + BRANCH=${{ github.event.inputs.branch || github.ref_name }} ./mvnw -B versions:set versions:commit -DnewVersion=$VERSION From 4aecb9f30494e2c9404c018e69c20eb7f5fab631 Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Wed, 13 Sep 2023 12:25:51 +0200 Subject: [PATCH 09/17] fix(cli): Testing GHA workflow cli release. Using merge branch for testing. --- .github/workflows/cli-release-process.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml index f6af0ce5bade..c72dee70e0d9 100644 --- a/.github/workflows/cli-release-process.yml +++ b/.github/workflows/cli-release-process.yml @@ -1,10 +1,6 @@ name: CLI Release on: - pull_request: - branches: - - master - - release-* workflow_dispatch: inputs: version: @@ -13,12 +9,16 @@ on: branch: description: 'Branch to cut from' required: true - default: 25951-implement-gha-generate-cli-release +# default: 25951-implement-gha-generate-cli-release # default: master dry_run: description: 'Dry run' required: true default: true + pull_request: + branches: + - master + - release-* env: JAVA_VERSION: 11 JAVA_DISTRO: temurin @@ -47,7 +47,7 @@ jobs: git config --global user.name "dcolina" git config --global user.email "daniel.colina@dotcms.com" - git branch -b $BRANCH +# git branch -b $BRANCH git commit -a -m "Releasing version $VERSION" git push origin "$BRANCH" @@ -93,6 +93,12 @@ jobs: env: JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }} + SLACK_WEBHOOK: ${{ secrets.RELEASE_SLACK_WEBHOOK }} + SLACK_USERNAME: dotBot + SLACK_TITLE: "Important news!" + SLACK_MSG_AUTHOR: " " + SLACK_FOOTER: "" + SLACK_ICON: https://avatars.slack-edge.com/temp/2021-12-08/2830145934625_e4e464d502865ff576e4.png working-directory: ${{ github.workspace }} run: | tools/dotcms-cli/mvnw -Prelease jreleaser:release -Djreleaser.git.root.search=true -pl :dotCMS-cli -Djreleaser.dry.run=${{ github.event.inputs.dry_run || true }} From 4c994c46d3dab7a27400bc078689388ed0d1fcd9 Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Wed, 13 Sep 2023 12:27:42 +0200 Subject: [PATCH 10/17] fix(cli): Testing GHA workflow cli release. Removing unuseful comments. --- .github/workflows/cli-release-process.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml index c72dee70e0d9..094406a7d54a 100644 --- a/.github/workflows/cli-release-process.yml +++ b/.github/workflows/cli-release-process.yml @@ -9,8 +9,7 @@ on: branch: description: 'Branch to cut from' required: true -# default: 25951-implement-gha-generate-cli-release -# default: master + dry_run: description: 'Dry run' required: true @@ -47,7 +46,6 @@ jobs: git config --global user.name "dcolina" git config --global user.email "daniel.colina@dotcms.com" -# git branch -b $BRANCH git commit -a -m "Releasing version $VERSION" git push origin "$BRANCH" From 50b88424b561c7d945d1befcb301cad763ba1a20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Enrique=20Colina=20Rodr=C3=ADguez?= Date: Wed, 13 Sep 2023 12:38:56 +0200 Subject: [PATCH 11/17] fix(cli): Testing update pom version for creating release. --- .github/workflows/cli-release-process.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml index 094406a7d54a..5d53e390724d 100644 --- a/.github/workflows/cli-release-process.yml +++ b/.github/workflows/cli-release-process.yml @@ -40,7 +40,7 @@ jobs: shell: bash run: | VERSION=${{ github.event.inputs.version || '1.1.0-SNAPSHOT' }} - BRANCH=${{ github.event.inputs.branch || github.ref_name }} + BRANCH=${{ github.event.inputs.branch || github.ref }} ./mvnw -B versions:set versions:commit -DnewVersion=$VERSION From 486090efd804819c0dc083272ed93cd9716decc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Enrique=20Colina=20Rodr=C3=ADguez?= Date: Wed, 13 Sep 2023 12:57:02 +0200 Subject: [PATCH 12/17] fix(cli): Testing CLI release process. --- .github/workflows/cli-release-process.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml index 5d53e390724d..dcb1ca43d575 100644 --- a/.github/workflows/cli-release-process.yml +++ b/.github/workflows/cli-release-process.yml @@ -41,13 +41,16 @@ jobs: run: | VERSION=${{ github.event.inputs.version || '1.1.0-SNAPSHOT' }} BRANCH=${{ github.event.inputs.branch || github.ref }} + + git checkout -b $BRANCH ./mvnw -B versions:set versions:commit -DnewVersion=$VERSION git config --global user.name "dcolina" git config --global user.email "daniel.colina@dotcms.com" + git commit -a -m "Releasing version $VERSION" - git push origin "$BRANCH" + git push origin $BRANCH release: needs: [ precheck ] @@ -56,7 +59,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 with: - ref: main + ref: master fetch-depth: 0 - name: Setup Java From 871d5dc97200fdb52f7d50875ffedc8ba720087f Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Wed, 13 Sep 2023 13:01:10 +0200 Subject: [PATCH 13/17] fix(cli): Testing with pull_request origin branch. --- .github/workflows/cli-release-process.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml index 5d53e390724d..13d193e5447f 100644 --- a/.github/workflows/cli-release-process.yml +++ b/.github/workflows/cli-release-process.yml @@ -40,12 +40,13 @@ jobs: shell: bash run: | VERSION=${{ github.event.inputs.version || '1.1.0-SNAPSHOT' }} - BRANCH=${{ github.event.inputs.branch || github.ref }} + BRANCH=${{ github.event.inputs.branch || '25951-implement-gha-generate-cli-release'}} ./mvnw -B versions:set versions:commit -DnewVersion=$VERSION git config --global user.name "dcolina" git config --global user.email "daniel.colina@dotcms.com" + git checkout -b "$BRANCH" git commit -a -m "Releasing version $VERSION" git push origin "$BRANCH" From 537dfd1c1df97ee5aa47cbfa6132ac82dd26010c Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Wed, 13 Sep 2023 14:14:09 +0200 Subject: [PATCH 14/17] fix(cli): Testing with workflow_dispatch trigger. --- .github/workflows/cli-release-process.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml index 6131a93cc898..3ba391911a24 100644 --- a/.github/workflows/cli-release-process.yml +++ b/.github/workflows/cli-release-process.yml @@ -14,10 +14,10 @@ on: description: 'Dry run' required: true default: true - pull_request: - branches: - - master - - release-* +# pull_request: +# branches: +# - master +# - release-* env: JAVA_VERSION: 11 JAVA_DISTRO: temurin From a50cdeb30a644d06aba0266ea36983ec2e849952 Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Wed, 13 Sep 2023 14:58:45 +0200 Subject: [PATCH 15/17] fix(cli): Testing basic GHA workflow. --- .github/workflows/cli-release-process.yml | 84 +---------------------- 1 file changed, 3 insertions(+), 81 deletions(-) diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml index 3ba391911a24..35dbedec63fd 100644 --- a/.github/workflows/cli-release-process.yml +++ b/.github/workflows/cli-release-process.yml @@ -1,5 +1,4 @@ name: CLI Release - on: workflow_dispatch: inputs: @@ -14,10 +13,7 @@ on: description: 'Dry run' required: true default: true -# pull_request: -# branches: -# - master -# - release-* + env: JAVA_VERSION: 11 JAVA_DISTRO: temurin @@ -26,80 +22,6 @@ jobs: precheck: name: Pre-check runs-on: ubuntu-latest - outputs: - VERSION: ${{ steps.vars.outputs.version }} - BRANCH: ${{ steps.vars.outputs.branch }} - DRY_RUN: ${{ github.event.inputs.dry_run }} - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Version - id: vars - working-directory: ${{ github.workspace }}/tools/dotcms-cli - shell: bash - run: | - VERSION=${{ github.event.inputs.version || '1.1.0-SNAPSHOT' }} - BRANCH=${{ github.event.inputs.branch || '25951-implement-gha-generate-cli-release'}} - - git checkout -b $BRANCH - - ./mvnw -B versions:set versions:commit -DnewVersion=$VERSION - - git config --global user.name "dcolina" - git config --global user.email "daniel.colina@dotcms.com" - - git commit -a -m "Releasing version $VERSION" - git push origin "$BRANCH" - - release: - needs: [ precheck ] - runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: master - fetch-depth: 0 - - - name: Setup Java - uses: actions/setup-java@v3 - with: - java-version: ${{ env.JAVA_VERSION }} - distribution: ${{ env.JAVA_DISTRO }} - - - name: Cache Maven - uses: actions/cache@v3 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - - name: Prepare dotCMS license - env: - DOTCMS_LICENSE_KEY: ${{ secrets.DOTCMS_LICENSE }} - run: | - DOTCMS_LICENSE_PATH=${GITHUB_WORKSPACE}/tools/dotcms-cli/license - mkdir -p ${DOTCMS_LICENSE_PATH} - echo "${DOTCMS_LICENSE_KEY}" > ${DOTCMS_LICENSE_PATH}/license.dat - echo "DOTCMS_LICENSE_FILE=${DOTCMS_LICENSE_PATH}/license.dat" >> "$GITHUB_ENV" - - - name: Build - working-directory: ${{ github.workspace }}/tools/dotcms-cli - run: | - ./mvnw -U clean install -DskipTests - ./mvnw package -Dquarkus.package.type=uber-jar -DskipTests - - - name: Releaser - env: - JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }} - SLACK_WEBHOOK: ${{ secrets.RELEASE_SLACK_WEBHOOK }} - SLACK_USERNAME: dotBot - SLACK_TITLE: "Important news!" - SLACK_MSG_AUTHOR: " " - SLACK_FOOTER: "" - SLACK_ICON: https://avatars.slack-edge.com/temp/2021-12-08/2830145934625_e4e464d502865ff576e4.png - working-directory: ${{ github.workspace }} - run: | - tools/dotcms-cli/mvnw -Prelease jreleaser:release -Djreleaser.git.root.search=true -pl :dotCMS-cli -Djreleaser.dry.run=${{ github.event.inputs.dry_run || true }} + - name: Hello world + run: echo "Hello world" From 203952df040687af52fa38586cf813d8887ff309 Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Wed, 13 Sep 2023 15:10:35 +0200 Subject: [PATCH 16/17] fix(cli): Testing basic GHA workflow. Run workflow button does not appear. --- .github/workflows/cli-release.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/cli-release.yml diff --git a/.github/workflows/cli-release.yml b/.github/workflows/cli-release.yml new file mode 100644 index 000000000000..7756bfcf5f8a --- /dev/null +++ b/.github/workflows/cli-release.yml @@ -0,0 +1,26 @@ +name: dotCLI Release +on: + workflow_dispatch: + inputs: + version: + description: 'Release version' + required: true + branch: + description: 'Branch to cut from' + required: true + dry_run: + description: 'Dry run' + required: true + default: true + +jobs: + helloworld: + name: Hello world + runs-on: ubuntu-latest + steps: + - name: Hello world + run: | + echo "Hello world" + echo "version: ${{ github.event.inputs.version }}" + echo "branch: ${{ github.event.inputs.branch }}" + echo "dry_run: ${{ github.event.inputs.dry_run }}" From 3fb7215220c51b926c6e571085ed9e6f941cea02 Mon Sep 17 00:00:00 2001 From: "daniel.colina" Date: Wed, 13 Sep 2023 15:16:45 +0200 Subject: [PATCH 17/17] fix(cli): Testing basic GHA workflow. Run workflow button does not appear. +1. --- .github/workflows/cli-release-process.yml | 27 ----------------------- .github/workflows/cli-release.yml | 7 ++++-- 2 files changed, 5 insertions(+), 29 deletions(-) delete mode 100644 .github/workflows/cli-release-process.yml diff --git a/.github/workflows/cli-release-process.yml b/.github/workflows/cli-release-process.yml deleted file mode 100644 index 35dbedec63fd..000000000000 --- a/.github/workflows/cli-release-process.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: CLI Release -on: - workflow_dispatch: - inputs: - version: - description: 'Release version' - required: true - branch: - description: 'Branch to cut from' - required: true - - dry_run: - description: 'Dry run' - required: true - default: true - -env: - JAVA_VERSION: 11 - JAVA_DISTRO: temurin - -jobs: - precheck: - name: Pre-check - runs-on: ubuntu-latest - steps: - - name: Hello world - run: echo "Hello world" diff --git a/.github/workflows/cli-release.yml b/.github/workflows/cli-release.yml index 7756bfcf5f8a..f6c29309aa27 100644 --- a/.github/workflows/cli-release.yml +++ b/.github/workflows/cli-release.yml @@ -12,6 +12,9 @@ on: description: 'Dry run' required: true default: true + push: + branches: + - '25951-implement-gha-generate-cli-release' jobs: helloworld: @@ -21,6 +24,6 @@ jobs: - name: Hello world run: | echo "Hello world" - echo "version: ${{ github.event.inputs.version }}" - echo "branch: ${{ github.event.inputs.branch }}" + echo "version: ${{ github.event.inputs.version || 'latest' }}" + echo "branch: ${{ github.event.inputs.branch || github.ref_name }}" echo "dry_run: ${{ github.event.inputs.dry_run }}"