forked from unab0mb/7h
-
Notifications
You must be signed in to change notification settings - Fork 26
134 lines (126 loc) · 4.22 KB
/
main-4.1.1.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
132
133
134
name: 7th-Heaven
run-name: 4.1.1.${{ github.run_number }}
on:
workflow_dispatch:
push:
branches:
- master
tags:
- "*"
pull_request:
branches:
- master
env:
_IS_BUILD_CANARY: false
_IS_GITHUB_RELEASE: false
_RELEASE_NAME: 7thHeaven
_RELEASE_VERSION: v0
_RELEASE_CONFIGURATION: Release
_BUILD_BRANCH: "${{ github.ref }}"
_BUILD_VERSION: "4.1.1.${{ github.run_number }}"
_CHANGELOG_VERSION: "0"
# VCPKG: Enable Binary Caching
VCPKG_BINARY_SOURCES: clear;nuget,github,readwrite
# GIT: Fix reporting from stderr to stdout
GIT_REDIRECT_STDERR: 2>&1
jobs:
CICD:
runs-on: windows-latest
timeout-minutes: 1440
strategy:
max-parallel: 1
steps:
- name: Set Git Config
run: |
git config --global core.autocrlf false
git config --global core.filemode false
git config --global core.longpaths true
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare Environment
run: ".github/workflows/prepare.ps1"
shell: pwsh
env:
GITHUB_PACKAGES_PAT: ${{ secrets.GITHUB_TOKEN }}
- name: Set versions in AssemblyInfo.cs
id: set-assembly-version
uses: tsunamods-codes/assemblyinfo-update@main
with:
version: "${{ env._BUILD_VERSION }}"
recursive: true
- name: Restore NuGet Packages
run: nuget restore ${{ github.workspace }}\${{ env._RELEASE_NAME }}.sln
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Run MSBuild
run: msbuild ${{ github.workspace }}\${{ env._RELEASE_NAME }}.sln /p:WindowsTargetPlatformVersion=10.0.19041.0 /m -p:Configuration=${{ env._RELEASE_CONFIGURATION }} -p:Platform="Any CPU"
- name: Prepare Installer
env:
BUILDPATH: "${{ github.workspace }}"
run: "${{ github.workspace }}\\.iss\\build.ps1"
shell: pwsh
- name: VirusTotal Scan
id: vt-scan
if: env._IS_GITHUB_RELEASE == 'true' && success()
uses: crazy-max/ghaction-virustotal@v4
with:
vt_api_key: ${{ secrets._VT_API_KEY }}
files: ".dist/*.exe"
- name: Parse VirusTotal Results
id: vt-res
if: env._IS_GITHUB_RELEASE == 'true' && success()
uses: actions/github-script@v7
with:
result-encoding: string
script: |
let ret = `${{ steps.vt-scan.outputs.analysis }}`;
ret = '- ' + ret
.replaceAll('.dist/','')
.replaceAll('=h', ': h')
.replaceAll(',', "\n- ");
console.log('Results:');
console.log(ret);
return ret;
- name: Publish PR artifacts
if: env._IS_GITHUB_RELEASE == 'false' && success()
uses: actions/upload-artifact@v4
with:
name: "${{ env._RELEASE_NAME }}-${{ env._RELEASE_VERSION }}"
path: ".dist/*"
- name: Publish Canary release
uses: ncipollo/release-action@v1
if: env._IS_GITHUB_RELEASE == 'true' && env._IS_BUILD_CANARY == 'true' && success()
with:
artifacts: ".dist/*"
allowUpdates: true
generateReleaseNotes: true
prerelease: true
removeArtifacts: true
tag: canary
name: "${{ env._RELEASE_NAME }}-${{ env._RELEASE_VERSION }}"
body: |
This is a canary build. Please be aware it may be prone to crashing and is NOT tested by anyone. Use this build AT YOUR OWN RISK!
🛡️ **VirusTotal analysis:**
${{ steps.vt-res.outputs.result }}
- name: Publish Stable release
uses: ncipollo/release-action@v1
if: env._IS_GITHUB_RELEASE == 'true' && env._IS_BUILD_CANARY == 'false' && success()
with:
artifacts: ".dist/*"
generateReleaseNotes: true
makeLatest: true
removeArtifacts: true
name: "${{ env._RELEASE_NAME }}-${{ env._RELEASE_VERSION }}"
body: |
🛡️ **VirusTotal analysis:**
${{ steps.vt-res.outputs.result }}
- name: Send alerts
if: env._IS_GITHUB_RELEASE == 'true' && success()
env:
_MAP_7TH_INTERNAL: "${{ secrets._7TH_INTERNAL }}"
_MAP_7TH_QHIMM: "${{ secrets._7TH_QHIMM }}"
_MAP_7TH_TSUNAMODS: "${{ secrets._7TH_TSUNAMODS }}"
run: ".github/workflows/alert.ps1"
shell: pwsh