Skip to content

Release

Release #64

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
tag:
description: 'Dev release tag'
required: true
type: string
dev:
description: 'Is dev build'
required: false
default: true
type: boolean
cliTag:
description: 'Version of the CLI to bundle'
required: false
type: string
workflow_call:
inputs:
tag:
description: 'Dev release tag'
required: true
type: string
dev:
description: 'Is dev build'
required: false
default: true
type: boolean
cliTag:
description: 'Version of the CLI to bundle'
required: false
type: string
jobs:
release:
runs-on: windows-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v4
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c #v1.3.1
with:
vs-version: '17.2'
- name: Install wget
run: |
choco install wget --no-progress
- name: Download CLI
if: inputs.cliTag
shell: bash
run: |
chmod +x ./.github/scripts/update_cli.sh
./.github/scripts/update_cli.sh ${{ inputs.cliTag }}
- name: Tag
shell: bash
run: |
echo ${{ inputs.tag }}
tag=${{ inputs.tag }}
echo "RELEASE_VERSION=${{ inputs.tag }}" >> $GITHUB_ENV
message='${{ inputs.tag }}'
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: Increment VSIX version
id: vsix_version
uses: timheuer/vsix-version-stamp@9d38292e99e54046455bb68c6a2b5113d269a7d0 #v2
with:
manifest-file: ast-visual-studio-extension\source.extension.vsixmanifest
version-number: ${{ inputs.tag }}
- name: Restore NuGet packages
run: msbuild -t:restore
- name: Build
run: msbuild .\ast-visual-studio-extension\ast-visual-studio-extension.csproj /p:Configuration=Release /p:DeployExtension=False
- name: Create Release
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 #v0.1.15
with:
tag_name: ${{ inputs.tag }}
prerelease: ${{ inputs.dev }}
generate_release_notes: true
files: '**/Release/ast-visual-studio-extension.vsix'
- name: Publish Release
uses: cezarypiatek/VsixPublisherAction@9c6b58b5955df9901a6e9834be1d0a94cd54aeba #1.0
if: inputs.dev == false
with:
extension-file: '.\ast-visual-studio-extension\bin\Release\ast-visual-studio-extension.vsix'
publish-manifest-file: '.\vs-publish.json'
personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }}
notify:
runs-on: ubuntu-latest
needs: release
if: inputs.dev == false
steps:
- name: Get latest relase notes
id: release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
body_release="$(gh api -H "Accept: application/vnd.github.v3+json" /repos/Checkmarx/ast-visual-studio-extension/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 Visual Studio Plugin ${{ env.RELEASE_VERSION }}</h1>${{ steps.clean.outputs.clean }}"