-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (146 loc) · 5.06 KB
/
TVTComment.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
169
170
171
172
173
174
175
name: TVTComment
on:
push:
paths:
- .github/workflows/TVTComment.yml
- Patch/TvtComment.*.patch
workflow_dispatch:
jobs:
build-exe:
runs-on: windows-latest
steps:
- name: Checkout Repository (TVTComment)
uses: actions/checkout@v4
with:
repository: noriokun4649/TVTComment
submodules: recursive
# - name: Update Submodules
# run: git submodule update --recursive --remote
- name: Checkout Repository (TVTComment-txt)
uses: actions/checkout@v4
with:
repository: SlashNephy/TVTComment-txt
path: TVTComment-txt
- name: Checkout Repository
uses: actions/checkout@v4
with:
path: TVTest-builder
- name: Apply Patches
shell: powershell
run: |
foreach ($item in Get-ChildItem TVTest-builder\Patch\TvtComment.*.patch)
{
Write-Output $item.FullName
git apply $item.FullName
}
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Replace Annict:ClientId and Annict:ClientSecret
shell: powershell
run: |
$data=Get-Content TVTComment/ViewModels/SettingsWindowViewModel.cs | % { $_ -replace 'secrets\["Annict:ClientId"\]','"${{ secrets.ANNICT_CLIENT_ID }}"' }
$data | Out-File TVTComment/ViewModels/SettingsWindowViewModel.cs
$data=Get-Content TVTComment/ViewModels/SettingsWindowViewModel.cs | % { $_ -replace 'secrets\["Annict:ClientSecret"\]','"${{ secrets.ANNICT_CLIENT_SECRET }}"' }
$data | Out-File TVTComment/ViewModels/SettingsWindowViewModel.cs
- name: Install CoreTweet
run: nuget sources add -name CoreTweetSource -source ${{ github.workspace }}\CoreTweetNuget
- name: Build
run: |
dotnet publish -m `
--configuration Release `
/p:PublishProfile="TVTComment/Properties/PublishProfiles/ReleaseProfile.pubxml" `
/p:CopyLocalLockFileAssemblies=true
- name: Prepare Artifact
shell: powershell
run: |
New-Item -Path Artifact/Plugins/TvtComment -ItemType Directory
Copy-Item -Path TVTComment/bin/Release/net8.0-windows/publish/* -Destination Artifact/Plugins/TvtComment/ -Recurse
Copy-Item -Path TVTComment/Data/* -Destination Artifact/Plugins/TvtComment/ -Recurse
Copy-Item -Path TVTComment-txt/*.txt -Destination Artifact/Plugins/TvtComment/ -Recurse
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: TvtComment_exe
if-no-files-found: error
path: Artifact/
deploy-exe:
needs: build-exe
uses: ./.github/workflows/deploy.yml
with:
artifact-name: 'TvtComment_exe'
secrets: inherit
permissions: {}
build-tvtp:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- platform: x64
deploy: true
- platform: Win32
deploy: false
outputs:
artifact: ${{ steps.output.outputs.artifact }}
should_deploy: ${{ steps.output.outputs.should_deploy }}
steps:
- name: Checkout Repository (TVTComment)
uses: actions/checkout@v4
with:
repository: noriokun4649/TVTComment
submodules: recursive
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Build
run: |
msbuild Viewer/Viewer.vcxproj `
-m `
/p:Configuration="Release" `
/p:Platform="${{ matrix.platform }}" `
/p:CodePage=932 `
/p:PlatformToolset=v143
- name: Prepare Artifacts
shell: powershell
run: |
New-Item -Path Artifact/Plugins -ItemType Directory
Copy-Item -Path Viewer/${{ matrix.platform }}/Release/TvtComment.tvtp -Destination Artifact/Plugins/
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: TvtComment_tvtp_${{ matrix.platform }}
if-no-files-found: error
path: Artifact/
- name: Set Job Outputs
id: output
uses: actions/github-script@v7
with:
script: |
core.setOutput("artifact", "TvtComment_tvtp_${{ matrix.platform }}")
core.setOutput("should_deploy", "${{ matrix.deploy }}")
deploy-tvtp:
needs: build-tvtp
if: needs.build-tvtp.outputs.should_deploy == 'true'
uses: ./.github/workflows/deploy.yml
with:
artifact-name: '${{ needs.build-tvtp.outputs.artifact }}'
secrets: inherit
permissions: {}
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- build-exe
- build-tvtp
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: Artifacts/
- name: Upload Release
uses: softprops/action-gh-release@v2
with:
files: Artifacts/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}