From 3b6d763f0e91fd6bef4e36464ad7895d3b8b2591 Mon Sep 17 00:00:00 2001 From: greensd4 <33864348+greensd4@users.noreply.github.com> Date: Mon, 10 Feb 2025 17:55:02 +0200 Subject: [PATCH 1/4] tag and create new release in one workflow --- .github/workflows/release.yml | 79 ++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 33 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 92ced8b0..3708a9a9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,47 +3,60 @@ name: Publish Checkmarx One CLI GitHub Action on: push: - tags: - - '*' + workflow_dispatch: + inputs: + tag: + description: 'Next release tag' + required: true jobs: release: runs-on: ubuntu-latest + outputs: + CLI_VERSION: ${{ steps.extract_cli_version.outputs.CLI_VERSION }} + steps: - - uses: actions/checkout@v4.1.0 + - name: Checkout + uses: actions/checkout@v4.1.0 + with: + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + + - name: Extract CLI version from Dockerfile + id: extract_cli_version + run: | + IMAGE_LINE=$(grep -m 1 '^FROM' Dockerfile) + CLI_VERSION=$(echo "$IMAGE_LINE" | awk -F':' '{print $2}') + + echo "Extracted CLI version: $CLI_VERSION" + + echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV + echo "::set-output name=CLI_VERSION::$CLI_VERSION" + + - name: Tag + run: | + echo ${{ github.event.inputs.tag }} + echo "NEXT_VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV + tag=${{ github.event.inputs.tag }} + message='${{ github.event.inputs.tag }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}' + 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: Create Release uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 #v1 with: - tag_name: ${{ github.ref_name }} + tag_name: ${{ github.event.inputs.tag }} generate_release_notes: true notify: - runs-on: ubuntu-latest - needs: release - steps: - - name: Get latest relase notes - id: release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - body_release="$(gh api -H "Accept: application/vnd.github.v3+json" /repos/Checkmarx/ast-github-action/releases/latest | jq -r '.body' )" - body_release="${body_release//$'\n'/'%0A'}" - echo "::set-output name=body_release::$body_release" - - name: Converts Markdown to HTML - id: convert - uses: lifepal/markdown-to-html@253bbd85fbdeafe2d1f18c1b9289be24e5cf8f8f #v1.2 - with: - text: "${{ steps.release.outputs.body_release }}" - - - name: Clean html - id: clean - run: | - clean="$(echo "${{ steps.convert.outputs.html }}" | awk '{gsub(/id=.[a-z]+/,"");print}' | tr -d '\n')" - echo "$clean" - echo "::set-output name=clean::$clean" - - name: Send a Notification - id: notify - uses: thechetantalwar/teams-notify@8a78811f5e8f58cdd204efebd79158006428c46b #v2 - with: - teams_webhook_url: ${{ secrets.TEAMS_WEBHOOK_URI }} - message: "

Checkmarx One Github Action ${{ github.ref_name }}

${{ steps.clean.outputs.clean }}" + needs: release + uses: Checkmarx/plugins-release-workflow/.github/workflows/release-notify.yml@main + with: + product_name: Github Action + release_version: ${{ github.event.inputs.tag }} + cli_release_version: ${{ needs.release.outputs.CLI_VERSION }} + release_author: "Phoenix Team" + release_url: https://github.com/Checkmarx/ast-github-action/releases/tag/${{ github.event.inputs.tag }} + jira_product_name: GITHUB_ACTION + secrets: inherit From 3e21ade88fec10166bf688687bd2ce2aa2c5afdc Mon Sep 17 00:00:00 2001 From: greensd4 <33864348+greensd4@users.noreply.github.com> Date: Mon, 10 Feb 2025 17:58:16 +0200 Subject: [PATCH 2/4] dispatch --- .github/workflows/release.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3708a9a9..3bc7e8f6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,12 +2,11 @@ name: Publish Checkmarx One CLI GitHub Action on: - push: - workflow_dispatch: - inputs: - tag: - description: 'Next release tag' - required: true + workflow_dispatch: + inputs: + tag: + description: 'Next release tag' + required: true jobs: release: From 28478b48f3780cdf059d22689798eed6efa92db7 Mon Sep 17 00:00:00 2001 From: greensd4 <33864348+greensd4@users.noreply.github.com> Date: Mon, 10 Feb 2025 17:59:57 +0200 Subject: [PATCH 3/4] dispatch --- .github/workflows/release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3bc7e8f6..d8d9a6a1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,11 +2,11 @@ name: Publish Checkmarx One CLI GitHub Action on: - workflow_dispatch: - inputs: - tag: - description: 'Next release tag' - required: true + workflow_call: + inputs: + tag: + description: 'Next release tag' + required: true jobs: release: From c7240250bc745b9b832ccda53fc6715d368aeeee Mon Sep 17 00:00:00 2001 From: greensd4 <33864348+greensd4@users.noreply.github.com> Date: Mon, 10 Feb 2025 18:02:25 +0200 Subject: [PATCH 4/4] chnages --- .github/workflows/issue_automation.yml | 2 +- .github/workflows/manual-tag.yml | 27 -------------------------- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 .github/workflows/manual-tag.yml diff --git a/.github/workflows/issue_automation.yml b/.github/workflows/issue_automation.yml index 232fcd70..38b6f807 100644 --- a/.github/workflows/issue_automation.yml +++ b/.github/workflows/issue_automation.yml @@ -7,7 +7,7 @@ on: jobs: issue: name: Notify Jira - uses: CheckmarxDev/ast-cli/.github/workflows/jira_notify.yml@main + uses: Checkmarx/ast-cli/.github/workflows/jira_notify.yml@main with: title: ${{ github.event.issue.title }} body: ${{ github.event.issue.body }} diff --git a/.github/workflows/manual-tag.yml b/.github/workflows/manual-tag.yml deleted file mode 100644 index b7985174..00000000 --- a/.github/workflows/manual-tag.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Manual Tag Creation - -on: - workflow_dispatch: - inputs: - tag: - description: 'Next release tag' - required: true - -jobs: - tag-creation: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4.1.0 - with: - token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - - name: Tag - run: | - echo ${{ github.event.inputs.tag }} - echo "NEXT_VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV - tag=${{ github.event.inputs.tag }} - message='${{ github.event.inputs.tag }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}' - 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}"