-
-
Notifications
You must be signed in to change notification settings - Fork 19
168 lines (140 loc) · 6.34 KB
/
main.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: .NET Core Desktop Build and Release
on:
push:
branches:
- 'Pre-Master'
- 'master'
env:
Solution_Name: vrcosc-magicchatbox.sln
Project_Path: vrcosc-magicchatbox\vrcosc_magicchatbox.csproj
jobs:
build-and-release:
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensure full history is checked out
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore Dependencies
run: dotnet restore ${{ env.Solution_Name }}
- name: Build Solution
run: dotnet build ${{ env.Solution_Name }} --configuration Release --no-restore -p:Platform="Any CPU"
- name: Extract Version from csproj
id: get_version
run: |
$csproj = "vrcosc-magicchatbox\MagicChatbox.csproj"
$pattern = '<Version>(.*)<\/Version>'
$content = Get-Content $csproj -Raw
$match = [regex]::Match($content, $pattern)
if ($match.Success -and $match.Groups.Count -gt 1) {
$version = $match.Groups[1].Value
echo "VERSION=$version" | Out-File -Append -Encoding utf8 $Env:GITHUB_ENV
} else {
echo "Error: Version not found in csproj file."
exit 1
}
shell: pwsh
- name: Create Zip File
run: |
Compress-Archive -Path vrcosc-magicchatbox/bin/Release/net6.0-windows10.0.22000.0/* -DestinationPath "MagicChatbox-${{ env.VERSION }}.zip"
- name: Upload and Scan with VirusTotal
id: virustotal_scan
run: |
$file_path = "./MagicChatbox-${{ env.VERSION }}.zip"
$api_key = "${{ secrets.VIRUSTOTAL_API_KEY }}"
$response = Invoke-RestMethod -Uri "https://www.virustotal.com/api/v3/files" -Method Post -Headers @{
"x-apikey" = $api_key
} -Form @{
"file" = Get-Item $file_path
}
$scan_id = $response.data.id
echo "::set-output name=SCAN_ID::$scan_id"
- name: Get VirusTotal Scan Report
id: virustotal_report
run: |
$api_key = "${{ secrets.VIRUSTOTAL_API_KEY }}"
$scan_id = "${{ steps.virustotal_scan.outputs.SCAN_ID }}"
$response = Invoke-RestMethod -Uri "https://www.virustotal.com/api/v3/analyses/$scan_id" -Headers @{
"x-apikey" = $api_key
}
$report_url = "https://www.virustotal.com/gui/file/$($response.meta.file_info.sha256)/detection"
echo "::set-output name=REPORT_URL::$report_url"
- name: Determine Release Type
id: determine_release_type
run: |
if ($GITHUB_REF -eq 'refs/heads/master') {
echo "PRE_RELEASE=false" | Out-File -Append -Encoding utf8 $Env:GITHUB_ENV
} else {
echo "PRE_RELEASE=true" | Out-File -Append -Encoding utf8 $Env:GITHUB_ENV
}
shell: pwsh
- name: Get Commits Since Last Release
id: get_commits
uses: simbo/changes-since-last-release-action@v1.0.1
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.MY_PAT }}
with:
tag_name: v${{ env.VERSION }}
release_name: v${{ env.VERSION }}
draft: false
prerelease: ${{ env.PRE_RELEASE }}
body: |
<div align="center">
<h1>MagicChatbox v${{ env.VERSION }}</h1>
<img src="https://img.shields.io/github/downloads/BoiHanny/vrcosc-magicchatbox/v${{ env.VERSION }}/total?color=%23AB3BFF&label=Version%20downloads&logo=%20&style=plastic" alt="Version downloads">
<p>
<a href="https://github.com/BoiHanny/vrcosc-magicchatbox/releases/download/v${{ env.VERSION }}/MagicChatbox-${{ env.VERSION }}.zip">
<img src="https://custom-icon-badges.herokuapp.com/badge/-Download-%23512BD4?style=for-the-badge&logo=download&logoColor=white" alt="Download">
</a>
<a href="${{ steps.virustotal_report.outputs.REPORT_URL }}">
<img src="https://custom-icon-badges.herokuapp.com/badge/-Virus%20Scan%20Result-blue?style=for-the-badge&logo=virustotal&logoColor=white" alt="VirusTotal">
</a>
</p>
</div>
<hr>
<div align="center">
<h2>Download and Installation</h2>
<p>Follow these steps to download and install the latest version of MagicChatbox.</p>
</div>
<ol>
<li>Download the .zip file from the link above.</li>
<li>Ensure you have <a href="https://dotnet.microsoft.com/en-us/download">.NET 6</a> installed.</li>
<li>Right-click on the downloaded .zip file and select <b>Extract All</b>.</li>
<li>The extracted content will be in a new folder in your downloads directory (or your chosen location).</li>
<li>Open the newly created folder.</li>
<li>Run <code>MagicChatbox.exe</code> to start the application.</li>
</ol>
<hr>
<div align="center">
<h2>Release Notes</h2>
<p>Details about the changes and improvements in this version.</p>
</div>
<ul>
${{ steps.get_commits.outputs.log }}
</ul>
<hr>
<div align="center">
<h2>Contact and Support</h2>
<p>Have any questions, suggestions, or feedback regarding MagicChatbox? We'd love to hear from you! Feel free to reach out to us through one of the following channels:</p>
<ul>
<li><strong>Discord:</strong> <a href="https://discord.gg/ZaSFwBfhvG">![Join us on Discord](https://dcbadge.vercel.app/api/server/ZaSFwBfhvG)</a></li>
<li><strong>GitHub Issues:</strong> <a href="https://github.com/BoiHanny/vrcosc-magicchatbox/issues">Report a bug or submit a feature request</a></li>
<li><strong>Wiki:</strong> <a href="https://github.com/BoiHanny/vrcosc-magicchatbox/wiki">Help & more</a></li>
</ul>
</div>
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.MY_PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./MagicChatbox-${{ env.VERSION }}.zip
asset_name: MagicChatbox-${{ env.VERSION }}.zip
asset_content_type: application/zip