Skip to content

Add release notify to release workflow (AST-000) #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 4, 2025
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 36 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,42 +50,52 @@ jobs:
release:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.OR_GITHUB_TOKEN }}
BRANCH_NAME: npm-version-patch
GITHUB_TOKEN: ${{ secrets.OR_GITHUB_TOKEN }}
BRANCH_NAME: npm-version-patch
outputs:
TAG_NAME: ${{ steps.generate_tag_name.outputs.TAG_NAME }}
CLI_VERSION: ${{ steps.extract_cli_version.outputs.CLI_VERSION }}
steps:

# CHECKOUT PROJECT
- uses: actions/checkout@v4
with:
fetch-depth: 0

# GIT CONFIGURATION
- run: |
- name: Git Configuration
run: |
git config user.name github-actions
git config user.email [email protected]

# SETUP NODE
- uses: actions/[email protected]
with:
node-version: 22.11.0
registry-url: https://npm.pkg.github.com/

# GET TAG NAME
- name: Generate Tag name
id: generate_tag_name
run: |
if [ ${{ inputs.dev }} == true ]; then
echo "TAG_NAME=$(npm version prerelease --preid=${{ inputs.jsTag }} --no-git-tag-version --allow-same-version)" >> $GITHUB_ENV
if [ "${{ inputs.dev }}" == "true" ]; then
TAG_NAME=$(npm version prerelease --preid=${{ inputs.jsTag }} --no-git-tag-version --allow-same-version)
else
echo "TAG_NAME=$(npm version patch --no-git-tag-version)" >> $GITHUB_ENV
TAG_NAME=$(npm version patch --no-git-tag-version)
fi

echo "Generated TAG_NAME: $TAG_NAME"
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "::set-output name=TAG_NAME::$TAG_NAME"

- name: Extract CLI version
id: extract_cli_version
run: |
CLI_VERSION=$(cat checkmarx-ast-cli.version | grep -Eo '^[0-9]+\.[0-9]+\.[0-9]+')
echo "CLI version being packed is $CLI_VERSION"
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
echo "::set-output name=CLI_VERSION::$CLI_VERSION"

# RUN NPM INSTALL AND BUILD
- name: NPM ci and build
run: |
npm ci
npm run build

# CREATE PR FOR VERSION
- name: Create Pull Request
id: create_pr
if: inputs.dev == false
Expand All @@ -98,32 +108,27 @@ jobs:
base: main
draft: false

# WAIT FOR PR CREATION
- name: Wait for PR to be created
id: pr
if: inputs.dev == false
uses: octokit/request-action@872c5c97b3c85c23516a572f02b31401ef82415d #v2.3.1
with:
route: GET /repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${{ env.BRANCH_NAME }}

# MERGE PR TO MAIN
- name: Merge Pull Request
if: inputs.dev == false
uses: octokit/request-action@872c5c97b3c85c23516a572f02b31401ef82415d #v2.3.1
with:
route: PUT /repos/${{ github.repository }}/pulls/${{ steps.create_pr.outputs.pull-request-number }}/merge
merge_method: squash

# PUSH TAGS IF IT IS A RELEASE
- name: Push tag
if: inputs.dev == false
run: |
git pull
git tag ${{env.TAG_NAME}}
git push --tags


# PUBLISH NPM PACKAGE
- name: Publish npm package
run: |
if [ ${{ inputs.dev }} == true ]; then
Expand All @@ -134,11 +139,23 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}

# CREATE RELEASE
- name: Create Release
uses: softprops/action-gh-release@a74c6b72af54cfa997e81df42d94703d6313a2d0 #v2
with:
name: ${{env.TAG_NAME}}
tag_name: ${{env.TAG_NAME}}
generate_release_notes: true
prerelease: ${{ inputs.dev }}

notify:
if: inputs.dev == false
needs: release
uses: Checkmarx/plugins-release-workflow/.github/workflows/release-notify.yml@main
with:
product_name: Javascript Runtime Wrapper
release_version: ${{ needs.release.outputs.TAG_NAME }}
cli_release_version: ${{ needs.release.outputs.CLI_VERSION }}
release_author: "Phoenix Team"
release_url: https://github.com/CheckmarxDev/ast-cli-javascript-wrapper-runtime-cli/releases/tag/${{ needs.release.outputs.TAG_NAME }}
jira_product_name: JS_RUNTIME_WRAPPER
secrets: inherit
Loading