Merge pull request #643 from Checkmarx/other/upgrade-js-wrappet-1.0.9 #104
Workflow file for this run
This file contains 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: Azure AST plugin release | |
on: | |
push: | |
tags: | |
- "*" | |
env: | |
PUBLISHER: Checkmarx | |
EXTENSION_ID: checkmarx-ast-azure-plugin | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4.0.3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: npm install | |
- run: sudo npm install -g tfx-cli | |
- name: Authenticate with GitHub package registry | |
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc | |
- name: Build step | |
run: | | |
npm install | |
cd cxAstScan/ | |
npm install | |
- run: npm run build | |
- name: Set new version | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Set major, minor, patch values | |
run: | | |
echo "MAJOR_VERSION=$(echo ${{ env.RELEASE_VERSION }} | cut -d. -f1)" >> $GITHUB_ENV | |
echo "MINOR_VERSION=$(echo ${{ env.RELEASE_VERSION }} | cut -d. -f2)" >> $GITHUB_ENV | |
echo "PATCH_VERSION=$(echo ${{ env.RELEASE_VERSION }} | cut -d. -f3)" >> $GITHUB_ENV | |
- name: New version | |
run: | | |
echo "The new version is ${{ env.RELEASE_VERSION }}" | |
echo "The new major version is ${{ env.MAJOR_VERSION }}" | |
echo "The new minor version is ${{ env.MINOR_VERSION }}" | |
echo "The new patch version is ${{ env.PATCH_VERSION }}" | |
- name: Set versions in files | |
run: | | |
cat <<< $(jq ".version = \"${{ env.RELEASE_VERSION }}\"" ./vss-extension.json) > ./vss-extension.json | |
cat <<< $(jq ".version = \"${{ env.RELEASE_VERSION }}\"" ./package.json) > ./package.json | |
cat <<< $(jq ".version.Major = ${{ env.MAJOR_VERSION }}" ./cxAstScan/task.json) > ./cxAstScan/task.json | |
cat <<< $(jq ".version.Minor = ${{ env.MINOR_VERSION }}" ./cxAstScan/task.json) > ./cxAstScan/task.json | |
cat <<< $(jq ".version.Patch = ${{ env.PATCH_VERSION }}" ./cxAstScan/task.json) > ./cxAstScan/task.json | |
- name: Create extension | |
run: tfx extension create --manifest-globs vss-extension.json | |
# Create the release | |
- name: Create Release | |
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 #v2.0.8 - Check for the latest version and updated here if there is a new one | |
with: | |
release_name: Checkmarx Azure ${{ env.RELEASE_VERSION }} | |
tag_name: ${{ env.RELEASE_VERSION }} | |
files: ./${{ env.PUBLISHER }}.${{ env.EXTENSION_ID }}-${{ env.RELEASE_VERSION }}.vsix | |
generate_release_notes: true | |
- name: Release to marketplace | |
run: tfx extension publish --vsix *.vsix --token ${{ secrets.AZURETOKEN }} | |
- name: Get latest release notes | |
id: release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
body_release="$(gh api -H "Accept: application/vnd.github.v3+json" /repos/Checkmarx/ast-azure-plugin/releases/latest | jq -r '.body' )" | |
body_release="${body_release//$'\n'/'%0A'}" | |
echo "::set-output name=body_release::$body_release" | |
- name: Converts Markdown to HTML | |
id: convert | |
uses: lifepal/markdown-to-html@253bbd85fbdeafe2d1f18c1b9289be24e5cf8f8f #v1.2 | |
with: | |
text: "${{ steps.release.outputs.body_release }}" | |
- name: Clean html | |
id: clean | |
run: | | |
clean="$(echo "${{ steps.convert.outputs.html }}" | awk '{gsub(/id=.[a-z]+/,"");print}' | tr -d '\n')" | |
echo "$clean" | |
echo "::set-output name=clean::$clean" | |
- name: Send a Notification | |
id: notify | |
uses: thechetantalwar/teams-notify@8a78811f5e8f58cdd204efebd79158006428c46b #v2 | |
with: | |
teams_webhook_url: ${{ secrets.TEAMS_WEBHOOK_URI }} | |
message: "<h1>Checkmarx Azure Plugin ${{ env.RELEASE_VERSION }}</h1>${{ steps.clean.outputs.clean }}" |