Skip to content

Commit 9ed2665

Browse files
Merge pull request #222 from Checkmarx/fix-releae-workflow
Tag and create new release in one workflow (AST-000)
2 parents dda03dc + c724025 commit 9ed2665

File tree

3 files changed

+47
-62
lines changed

3 files changed

+47
-62
lines changed

.github/workflows/issue_automation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
issue:
99
name: Notify Jira
10-
uses: CheckmarxDev/ast-cli/.github/workflows/jira_notify.yml@main
10+
uses: Checkmarx/ast-cli/.github/workflows/jira_notify.yml@main
1111
with:
1212
title: ${{ github.event.issue.title }}
1313
body: ${{ github.event.issue.body }}

.github/workflows/manual-tag.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,60 @@
22
name: Publish Checkmarx One CLI GitHub Action
33

44
on:
5-
push:
6-
tags:
7-
- '*'
5+
workflow_call:
6+
inputs:
7+
tag:
8+
description: 'Next release tag'
9+
required: true
810

911
jobs:
1012
release:
1113
runs-on: ubuntu-latest
14+
outputs:
15+
CLI_VERSION: ${{ steps.extract_cli_version.outputs.CLI_VERSION }}
16+
1217
steps:
13-
- uses: actions/[email protected]
18+
- name: Checkout
19+
uses: actions/[email protected]
20+
with:
21+
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
22+
23+
- name: Extract CLI version from Dockerfile
24+
id: extract_cli_version
25+
run: |
26+
IMAGE_LINE=$(grep -m 1 '^FROM' Dockerfile)
27+
CLI_VERSION=$(echo "$IMAGE_LINE" | awk -F':' '{print $2}')
28+
29+
echo "Extracted CLI version: $CLI_VERSION"
30+
31+
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
32+
echo "::set-output name=CLI_VERSION::$CLI_VERSION"
33+
34+
- name: Tag
35+
run: |
36+
echo ${{ github.event.inputs.tag }}
37+
echo "NEXT_VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
38+
tag=${{ github.event.inputs.tag }}
39+
message='${{ github.event.inputs.tag }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}'
40+
git config user.name "${GITHUB_ACTOR}"
41+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
42+
git tag -a "${tag}" -m "${message}"
43+
git push origin "${tag}"
44+
1445
- name: Create Release
1546
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 #v1
1647
with:
17-
tag_name: ${{ github.ref_name }}
48+
tag_name: ${{ github.event.inputs.tag }}
1849
generate_release_notes: true
1950

2051
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 }}"
52+
needs: release
53+
uses: Checkmarx/plugins-release-workflow/.github/workflows/release-notify.yml@main
54+
with:
55+
product_name: Github Action
56+
release_version: ${{ github.event.inputs.tag }}
57+
cli_release_version: ${{ needs.release.outputs.CLI_VERSION }}
58+
release_author: "Phoenix Team"
59+
release_url: https://github.com/Checkmarx/ast-github-action/releases/tag/${{ github.event.inputs.tag }}
60+
jira_product_name: GITHUB_ACTION
61+
secrets: inherit

0 commit comments

Comments
 (0)