From 16eca4ecf2369f14f6f68e81f2eb7c3da2df3c15 Mon Sep 17 00:00:00 2001 From: Diogo Pimenta Date: Thu, 20 Apr 2023 16:13:04 +0100 Subject: [PATCH 1/8] Fix release version from workflow_dispatch --- .github/workflows/release-dev.yml | 3 ++- .github/workflows/release.yml | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 46cc7f0c..e8b2b847 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -26,9 +26,10 @@ jobs: git config user.name "${GITHUB_ACTOR}" git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" git tag -a "${tag}" -m "${message}" + git push origin "${tag}" - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + run: echo "RELEASE_VERSION=${{ inputs.tag }}" >> $GITHUB_ENV - name: Echo env run: echo ${{ env.RELEASE_VERSION }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 19668ab7..20591738 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,7 @@ name: Release Creation on: - push: - tags: - - "*" + workflow_dispatch: jobs: release: From ad58e47920f7a6f85a39f0ffd10e6a77f165a876 Mon Sep 17 00:00:00 2001 From: Diogo Pimenta Date: Thu, 20 Apr 2023 16:13:43 +0100 Subject: [PATCH 2/8] Remove tag push from dev release --- .github/workflows/release-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index e8b2b847..0ad92084 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -26,7 +26,7 @@ jobs: git config user.name "${GITHUB_ACTOR}" git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" git tag -a "${tag}" -m "${message}" - git push origin "${tag}" +# git push origin "${tag}" - name: Set env run: echo "RELEASE_VERSION=${{ inputs.tag }}" >> $GITHUB_ENV From 41a21b33a58fe080d03d814ea019c9ceccb70295 Mon Sep 17 00:00:00 2001 From: Diogo Pimenta Date: Thu, 20 Apr 2023 16:23:08 +0100 Subject: [PATCH 3/8] Remove tag from dev release --- .github/workflows/release-dev.yml | 48 ++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 0ad92084..721e3cef 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -7,6 +7,11 @@ on: description: 'Dev release tag' required: true type: string + cliTag: + description: 'Version of the CLI to bundle' + required: false + default: latest + type: string jobs: release: @@ -17,19 +22,36 @@ jobs: with: token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - - name: Tag + - name: Download CLI run: | - echo ${{ inputs.tag }} - echo "NEXT_VERSION=${{ inputs.tag }}" >> $GITHUB_ENV - tag=${{ inputs.tag }} - message='${{ inputs.tag }}' - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - git tag -a "${tag}" -m "${message}" -# git push origin "${tag}" + chmod +x ./.github/scripts/update_cli.sh + ./.github/scripts/update_cli.sh ${{ inputs.cliTag }} + + - name: Cache local Maven repository + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Set up Maven Central Repository + uses: actions/setup-java@v3.11.0 + with: + java-version: '11' + distribution: 'temurin' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE - - name: Set env - run: echo "RELEASE_VERSION=${{ inputs.tag }}" >> $GITHUB_ENV + - name: Update the POM version. + run: mvn -B versions:set -DnewVersion='${{ inputs.tag }}' --file pom.xml -DskipTests - - name: Echo env - run: echo ${{ env.RELEASE_VERSION }} + - name: Publish package + run: mvn --batch-mode deploy -DskipTests -Dast.wrapper.id=ast-cli-java-wrapper-dev + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} From f47f49d57fb8b19331031dbc70888835ebf95387 Mon Sep 17 00:00:00 2001 From: Diogo Pimenta Date: Thu, 20 Apr 2023 16:23:40 +0100 Subject: [PATCH 4/8] Disable MVN publish --- .github/workflows/release-dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 721e3cef..06925121 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -50,6 +50,7 @@ jobs: run: mvn -B versions:set -DnewVersion='${{ inputs.tag }}' --file pom.xml -DskipTests - name: Publish package + if: false run: mvn --batch-mode deploy -DskipTests -Dast.wrapper.id=ast-cli-java-wrapper-dev env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} From 85d23abfa52835d13659a65506fd89f0379bacc5 Mon Sep 17 00:00:00 2001 From: Diogo Pimenta Date: Thu, 20 Apr 2023 16:25:18 +0100 Subject: [PATCH 5/8] Require CLI tag --- .github/workflows/release-dev.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 06925121..2cdaca6a 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -9,8 +9,7 @@ on: type: string cliTag: description: 'Version of the CLI to bundle' - required: false - default: latest + required: true type: string jobs: From dd208b1d661cfc1b0403617b1a906d37644b8bda Mon Sep 17 00:00:00 2001 From: Diogo Pimenta Date: Thu, 20 Apr 2023 16:27:04 +0100 Subject: [PATCH 6/8] Enable publish --- .github/workflows/release-dev.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml index 2cdaca6a..5d5ec0f0 100644 --- a/.github/workflows/release-dev.yml +++ b/.github/workflows/release-dev.yml @@ -49,7 +49,6 @@ jobs: run: mvn -B versions:set -DnewVersion='${{ inputs.tag }}' --file pom.xml -DskipTests - name: Publish package - if: false run: mvn --batch-mode deploy -DskipTests -Dast.wrapper.id=ast-cli-java-wrapper-dev env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} From 1a92281b04fb69c824869778361ef5e3195740c3 Mon Sep 17 00:00:00 2001 From: Diogo Pimenta Date: Fri, 21 Apr 2023 13:08:01 +0100 Subject: [PATCH 7/8] Merge release-dev with release and add nightly --- .github/workflows/nightly.yml | 26 ++++++++++++++ .github/workflows/release-dev.yml | 56 ------------------------------- .github/workflows/release.yml | 36 ++++++++++++++++++-- 3 files changed, 59 insertions(+), 59 deletions(-) create mode 100644 .github/workflows/nightly.yml delete mode 100644 .github/workflows/release-dev.yml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..f40af695 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,26 @@ +name: Nightly Release + +on: + push: + branches: + - main + +jobs: + delete_tag: + runs-on: ubuntu-latest + steps: + - name: Delete release + uses: dev-drprasad/delete-tag-and-release@v0.2.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + delete_release: true + tag_name: 0.0.0-SNAPSHOT + nightly: + needs: delete_tag + uses: CheckmarxDev/ast-cli-java-wrapper/.github/workflows/release.yml@main + with: + tag: "0.0.0-SNAPSHOT" + dev: false + cliTag: "2.0.0-nightly" + secrets: inherit diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml deleted file mode 100644 index 5d5ec0f0..00000000 --- a/.github/workflows/release-dev.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Dev Release Creation - -on: - workflow_dispatch: - inputs: - tag: - description: 'Dev release tag' - required: true - type: string - cliTag: - description: 'Version of the CLI to bundle' - required: true - type: string - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - - - name: Download CLI - run: | - chmod +x ./.github/scripts/update_cli.sh - ./.github/scripts/update_cli.sh ${{ inputs.cliTag }} - - - name: Cache local Maven repository - uses: actions/cache@v3 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - - name: Set up Maven Central Repository - uses: actions/setup-java@v3.11.0 - with: - java-version: '11' - distribution: 'temurin' - server-id: ossrh - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD - gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - gpg-passphrase: MAVEN_GPG_PASSPHRASE - - - name: Update the POM version. - run: mvn -B versions:set -DnewVersion='${{ inputs.tag }}' --file pom.xml -DskipTests - - - name: Publish package - run: mvn --batch-mode deploy -DskipTests -Dast.wrapper.id=ast-cli-java-wrapper-dev - env: - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 20591738..b9fcd588 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,20 @@ name: Release Creation on: workflow_dispatch: + inputs: + tag: + description: 'Dev release tag' + required: true + type: string + dev: + description: 'Is dev build' + required: false + default: true + type: boolean + cliTag: + description: 'Version of the CLI to bundle' + required: true + type: string jobs: release: @@ -12,8 +26,16 @@ jobs: with: token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - - name: Set env - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Tag + run: | + echo ${{ inputs.tag }} + tag=${{ inputs.tag }} + echo "RELEASE_VERSION=${{ inputs.tag }}" >> $GITHUB_ENV + message='${{ inputs.tag }}' + git config user.name "${GITHUB_ACTOR}" + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + git tag -a "${tag}" -m "${message}" + git push origin "${tag}" - name: Cache local Maven repository uses: actions/cache@v3 @@ -37,8 +59,16 @@ jobs: - name: Update the POM version. run: mvn -B versions:set -DnewVersion='${{ env.RELEASE_VERSION }}' --file pom.xml -DskipTests + - name: Build artifactId property + run: | + prop='' + if [ ${{ inputs.dev }} = true ]; then + prop='-Dast.wrapper.id=ast-cli-java-wrapper-dev' + fi + echo "AID_PROP=${prop}" >> $GITHUB_ENV + - name: Publish package - run: mvn --batch-mode deploy -DskipTests + run: mvn --batch-mode deploy -DskipTests ${{ env.AID_PROP }} env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} From 36db70d320a8a7c5b2504a7a2468ba892830be86 Mon Sep 17 00:00:00 2001 From: Diogo Pimenta Date: Fri, 21 Apr 2023 13:10:15 +0100 Subject: [PATCH 8/8] Allow workflow_call --- .github/workflows/release.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9fcd588..774cbfca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,21 @@ on: description: 'Version of the CLI to bundle' required: true type: string + workflow_call: + inputs: + tag: + description: 'Dev release tag' + required: true + type: string + dev: + description: 'Is dev build' + required: false + default: true + type: boolean + cliTag: + description: 'Version of the CLI to bundle' + required: true + type: string jobs: release: