-
Notifications
You must be signed in to change notification settings - Fork 6
132 lines (118 loc) · 4.24 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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@a74c6b72af54cfa997e81df42d94703d6313a2d0 #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 }}"