Skip to content

Publish Checkmarx One CLI GitHub Action #102

Publish Checkmarx One CLI GitHub Action

Publish Checkmarx One CLI GitHub Action #102

Workflow file for this run

name: Publish Checkmarx One CLI GitHub Action
on:
workflow_dispatch:
inputs:
tag:
description: 'Next release tag'
required: true
jobs:
release:
runs-on: cx-public-ubuntu-x64
permissions:
contents: write
outputs:
CLI_VERSION: ${{ steps.extract_cli_version.outputs.CLI_VERSION }}
steps:
- name: Install Harden Runner
uses: checkmarx/harden-runner-action@9af89fc71515a100421586dfdb3dc9c984fbf411 #v2.19.4
with:
use-policy-store: true
api-key: ${{ secrets.STEP_SECURITY_API_KEY }}
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract full CLI version from Dockerfile
id: extract_cli_version
run: |
IMAGE_LINE=$(grep -m 1 '^FROM' Dockerfile | awk '{print $2}') # Extract the full image reference
IMAGE_TAG=$(echo "$IMAGE_LINE" | cut -d':' -f2-) # Get everything after the first colon
echo "Extracted CLI version: $IMAGE_TAG"
echo "CLI_VERSION=$IMAGE_TAG" >> $GITHUB_ENV
echo "::set-output name=CLI_VERSION::$IMAGE_TAG"
- 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: step-security/action-gh-release@277bfa82abcfdb73e5bbb19e213fd76532ee2be5 # v3.0.0
with:
tag_name: ${{ github.event.inputs.tag }}
generate_release_notes: true
token: ${{ secrets.GITHUB_TOKEN }}
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