@@ -3,47 +3,60 @@ name: Publish Checkmarx One CLI GitHub Action
33
44on :
55 push :
6- tags :
7- - ' *'
6+ workflow_dispatch :
7+ inputs :
8+ tag :
9+ description : ' Next release tag'
10+ required : true
811
912jobs :
1013 release :
1114 runs-on : ubuntu-latest
15+ outputs :
16+ CLI_VERSION : ${{ steps.extract_cli_version.outputs.CLI_VERSION }}
17+
1218 steps :
13- 19+ - name : Checkout
20+ 21+ with :
22+ token : ${{ secrets.PERSONAL_ACCESS_TOKEN }}
23+
24+ - name : Extract CLI version from Dockerfile
25+ id : extract_cli_version
26+ run : |
27+ IMAGE_LINE=$(grep -m 1 '^FROM' Dockerfile)
28+ CLI_VERSION=$(echo "$IMAGE_LINE" | awk -F':' '{print $2}')
29+
30+ echo "Extracted CLI version: $CLI_VERSION"
31+
32+ echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
33+ echo "::set-output name=CLI_VERSION::$CLI_VERSION"
34+
35+ - name : Tag
36+ run : |
37+ echo ${{ github.event.inputs.tag }}
38+ echo "NEXT_VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
39+ tag=${{ github.event.inputs.tag }}
40+ message='${{ github.event.inputs.tag }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}'
41+ git config user.name "${GITHUB_ACTOR}"
42+ git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
43+ git tag -a "${tag}" -m "${message}"
44+ git push origin "${tag}"
45+
1446 - name : Create Release
1547 uses : softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
1648 with :
17- tag_name : ${{ github.ref_name }}
49+ tag_name : ${{ github.event.inputs.tag }}
1850 generate_release_notes : true
1951
2052 notify :
21- runs-on : ubuntu-latest
22- needs : release
23- steps :
24- - name : Get latest relase notes
25- id : release
26- env :
27- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
28- run : |
29- body_release="$(gh api -H "Accept: application/vnd.github.v3+json" /repos/Checkmarx/ast-github-action/releases/latest | jq -r '.body' )"
30- body_release="${body_release//$'\n'/'%0A'}"
31- echo "::set-output name=body_release::$body_release"
32- - name : Converts Markdown to HTML
33- id : convert
34- uses : lifepal/markdown-to-html@253bbd85fbdeafe2d1f18c1b9289be24e5cf8f8f # v1.2
35- with :
36- text : " ${{ steps.release.outputs.body_release }}"
37-
38- - name : Clean html
39- id : clean
40- run : |
41- clean="$(echo "${{ steps.convert.outputs.html }}" | awk '{gsub(/id=.[a-z]+/,"");print}' | tr -d '\n')"
42- echo "$clean"
43- echo "::set-output name=clean::$clean"
44- - name : Send a Notification
45- id : notify
46- uses : thechetantalwar/teams-notify@8a78811f5e8f58cdd204efebd79158006428c46b # v2
47- with :
48- teams_webhook_url : ${{ secrets.TEAMS_WEBHOOK_URI }}
49- message : " <h1>Checkmarx One Github Action ${{ github.ref_name }}</h1>${{ steps.clean.outputs.clean }}"
53+ needs : release
54+ uses : Checkmarx/plugins-release-workflow/.github/workflows/release-notify.yml@main
55+ with :
56+ product_name : Github Action
57+ release_version : ${{ github.event.inputs.tag }}
58+ cli_release_version : ${{ needs.release.outputs.CLI_VERSION }}
59+ release_author : " Phoenix Team"
60+ release_url : https://github.com/Checkmarx/ast-github-action/releases/tag/${{ github.event.inputs.tag }}
61+ jira_product_name : GITHUB_ACTION
62+ secrets : inherit
0 commit comments