-
Notifications
You must be signed in to change notification settings - Fork 1.1k
122 lines (104 loc) · 4.85 KB
/
CI.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
name: CI
on: [push, pull_request, workflow_dispatch]
env:
ProjectName: ShadowsocksR
jobs:
build:
name: Build
runs-on: windows-latest
env:
SyncfusionLicenseKey: ${{ secrets.SyncfusionLicenseKey }}
NET_TFM: net7.0-windows
Configuration: Release
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- name: Setup NuGet Private Sources
shell: pwsh
run: dotnet nuget add source https://nuget.pkg.github.com/HMBSbige/index.json -n GitHub-HMBSbige -u HMBSbige -p ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
- name: Build .NET App
shell: pwsh
run: .\build.ps1 app
- name: Build x64
shell: pwsh
run: .\build.ps1 x64
- name: Build x86
shell: pwsh
run: .\build.ps1 x86
- name: Upload .NET App
continue-on-error: true
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ProjectName }}
path: shadowsocks-csharp\bin\${{ env.Configuration }}\${{ env.NET_TFM }}\publish\
- name: Upload x64
continue-on-error: true
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ProjectName }}-Win64
path: shadowsocks-csharp\bin\${{ env.Configuration }}\${{ env.NET_TFM }}\win-x64\publish\
- name: Upload x86
continue-on-error: true
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.ProjectName }}-Win32
path: shadowsocks-csharp\bin\${{ env.Configuration }}\${{ env.NET_TFM }}\win-x86\publish\
- name: Get tag
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
id: tag
uses: dawidd6/action-get-tag@v1
- name: Package .NET App
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
shell: pwsh
run: |
New-Item -ItemType Directory -Path C:\builtfiles -Force > $null
$zip_path = "C:\builtfiles\$env:ProjectName-${{ steps.tag.outputs.tag }}.7z"
7z a -mx9 "$zip_path" ".\shadowsocks-csharp\bin\$env:Configuration\$env:NET_TFM\publish\"
7z rn "$zip_path" publish $env:ProjectName
echo "NET_SHA256=$((Get-FileHash $zip_path -Algorithm SHA256).Hash)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Package x64
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
shell: pwsh
run: |
New-Item -ItemType Directory -Path C:\builtfiles -Force > $null
$zip_path = "C:\builtfiles\$env:ProjectName-Win64-${{ steps.tag.outputs.tag }}.7z"
7z a -mx9 "$zip_path" ".\shadowsocks-csharp\bin\$env:Configuration\$env:NET_TFM\win-x64\publish\"
7z rn "$zip_path" publish $env:ProjectName
echo "NET64_SHA256=$((Get-FileHash $zip_path -Algorithm SHA256).Hash)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Package x86
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
shell: pwsh
run: |
New-Item -ItemType Directory -Path C:\builtfiles -Force > $null
$zip_path = "C:\builtfiles\$env:ProjectName-Win32-${{ steps.tag.outputs.tag }}.7z"
7z a -mx9 "$zip_path" ".\shadowsocks-csharp\bin\$env:Configuration\$env:NET_TFM\win-x86\publish\"
7z rn "$zip_path" publish $env:ProjectName
echo "NET86_SHA256=$((Get-FileHash $zip_path -Algorithm SHA256).Hash)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Create a new GitHub release if a new tag is pushed
uses: ncipollo/release-action@v1
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: v${{ steps.tag.outputs.tag }}
prerelease: true
draft: false
artifacts: C:\builtfiles\*
body: |
[![](https://img.shields.io/badge/Channel-blue?label=Telegram&logo=telegram)](https://t.me/ShadowsocksR_Windows) [![](https://img.shields.io/badge/Group-green?label=Telegram&logo=telegram)](https://t.me/joinchat/Gn-Aa0-j4HcpdBaW-Iv8Sw)
## 更新日志:
* 这是 GitHub Action 自动化部署,更新日志应该很快会手动更新
## 文件校验
| 文件名 | SHA256 |
| :- | :- |
| <sub>${{ env.ProjectName }}-${{ steps.tag.outputs.tag }}.7z</sub> | <sub>${{ env.NET_SHA256 }}</sub> |
| <sub>${{ env.ProjectName }}-Win64-${{ steps.tag.outputs.tag }}.7z</sub> | <sub>${{ env.NET64_SHA256 }}</sub> |
| <sub>${{ env.ProjectName }}-Win32-${{ steps.tag.outputs.tag }}.7z</sub> | <sub>${{ env.NET86_SHA256 }}</sub> |