-
Notifications
You must be signed in to change notification settings - Fork 11
108 lines (90 loc) · 3.34 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
name: Auto-Release on PR Merged
on:
push:
branches: ["main"]
jobs:
build:
runs-on:
windows-latest
env:
Solution_Name: MidiControl.sln
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Bump version and push tag
id: tag
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
with:
msbuild-architecture: x64
- name: Setup NuGet
uses: nuget/setup-nuget@v1
- name: Restore NuGet Packages
run: nuget restore $env:Solution_Name
- name: Set Variable
id: vars
run: |
VERSION=${{ steps.tag.outputs.new_tag }}
echo "version=${VERSION:1}" >> $GITHUB_OUTPUT
echo "file=MIDIControl_${VERSION:1}_Setup.exe" >> $GITHUB_OUTPUT
shell: bash
- name: Replace Secrets
id: secrets
run: |
sed -i "s/TWITCH_CLIENTSECRET/${{ secrets.TWITCH_CLIENTSECRET }}/g" "MidiControl/App.config" &&
sed -i "s/TWITCH_CLIENTID/${{ secrets.TWITCH_CLIENTID }}/g" "MidiControl/App.config"
shell: bash
- name: Replace Version
id: code_version
run: |
sed -i "s/VERSION/${{ steps.vars.outputs.version }}/g" "MidiControl/Properties/AssemblyInfo.cs"
shell: bash
- name: Resource generation
run: |
Set-Location -Path "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\"
.\ResGen.exe "D:\a\MidiControl\MidiControl\MidiControl\Properties\Resources.resx" /useSourcePath /str:csharp,MidiControl.Properties
shell: powershell
- name: Build app for Release
run: msbuild $env:Solution_Name -t:rebuild -verbosity:diag -property:Configuration=Release
- name: Building the installer
run: |
"%programfiles(x86)%\Inno Setup 6\iscc.exe" "setup.iss"
shell: cmd
- name: Upload Artifact
uses: actions/upload-artifact@v3
id: artifact
with:
path: "./Output/${{ steps.vars.outputs.file }}"
- name: VirusTotal Scan
id: virustotal
uses: crazy-max/ghaction-virustotal@v3
with:
vt_api_key: ${{ secrets.VT_API_KEY }}
update_release_body: true
files: |
./Output/${{ steps.vars.outputs.file }}
- name: Formatting Text
id: format_text
run: |
ANALYSIS=${{ steps.virustotal.outputs.analysis }}
SEARCHSTRING="exe="
LINK=${ANALYSIS#*$SEARCHSTRING}
echo "virustotal=🛡️ [${{ steps.vars.outputs.file }}](${LINK})" >> $GITHUB_OUTPUT
shell: bash
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: "MIDIControl version ${{ steps.vars.outputs.version }}"
body: "${{ steps.tag.outputs.changelog }} \n ${{ steps.format_text.outputs.virustotal }}"
tag_name: ${{ steps.tag.outputs.new_tag }}
generate_release_notes: true
append_body: true
files: "./Output/${{ steps.vars.outputs.file }}"
fail_on_unmatched_files: true
prerelease: true