Publish Checkmarx One CLI GitHub Action #62
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Checkmarx One CLI GitHub Action | |
| on: | |
| 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: | |
| - name: Checkout | |
| uses: actions/[email protected] | |
| 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.event.inputs.tag }} | |
| generate_release_notes: true | |
| notify: | |
| 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 |