-
Notifications
You must be signed in to change notification settings - Fork 2
129 lines (107 loc) · 3.73 KB
/
Copy pathci-workflow.yml
File metadata and controls
129 lines (107 loc) · 3.73 KB
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
name: Build DirectorPrompt
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
build-release:
name: Build Release on Windows
runs-on: windows-latest
if: "startsWith(github.ref, 'refs/tags/')"
permissions:
contents: write
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true
- name: Setup .NET 10 SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '22'
- name: Restore Nuget Packages
run: dotnet restore DirectorPrompt.slnx
- name: Run Tests
run: dotnet test --solution DirectorPrompt.slnx -c Release --no-restore
- name: Define VERSION
run: |
$env:COMMIT = $env:GITHUB_SHA.Substring(0, 7)
$env:REPO_NAME = $env:GITHUB_REPOSITORY -replace '.*/'
$env:BRANCH = $env:GITHUB_REF -replace '.*/'
($env:REPO_NAME) >> VERSION
($env:BRANCH) >> VERSION
($env:COMMIT) >> VERSION
- name: Build Release
run: dotnet build DirectorPrompt.slnx -c Release
- name: Generate Hashes File
run: .\scripts\CreateHashList.ps1 .\bin\Release
- name: Velopack Build and Upload
id: build-velopack
env:
GH_TOKEN: ${{ github.token }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: |
$version = $env:GITHUB_REF -replace '.*/'
echo "version=$version" >> $env:GITHUB_OUTPUT
.\scripts\ci-velopack-upload.ps1
- name: Purge CF cache after R2 upload
if: success()
continue-on-error: true
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
shell: pwsh
run: |
$body = '{"files":["https://dp-distribute.atmoomen.top/releases.win.json"]}'
try {
Invoke-RestMethod -Uri "https://api.cloudflare.com/client/v4/zones/$env:CLOUDFLARE_ZONE_ID/purge_cache" `
-Method Post `
-Headers @{ Authorization = "Bearer $env:CLOUDFLARE_API_TOKEN" } `
-ContentType 'application/json' `
-Body $body
Write-Host "Purged: /releases.win.json"
}
catch {
Write-Warning "Purge failed: $_"
}
build:
name: Build on Windows
runs-on: windows-latest
if: "!startsWith(github.ref, 'refs/tags/')"
permissions:
contents: read
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true
- name: Setup .NET 10 SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Restore Nuget Packages
run: dotnet restore DirectorPrompt.slnx
- name: Run Tests
run: dotnet test --solution DirectorPrompt.slnx -c Release --no-restore
- name: Define VERSION
run: |
$env:COMMIT = $env:GITHUB_SHA.Substring(0, 7)
$env:REPO_NAME = $env:GITHUB_REPOSITORY -replace '.*/'
$env:BRANCH = $env:GITHUB_REF -replace '.*/'
($env:REPO_NAME) >> VERSION
($env:BRANCH) >> VERSION
($env:COMMIT) >> VERSION
- name: Build Release
run: dotnet build DirectorPrompt.slnx -c Release
- name: Generate Hashes File
run: .\scripts\CreateHashList.ps1 .\bin\Release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: directorprompt-artifact
path: bin\Release\