-
-
Notifications
You must be signed in to change notification settings - Fork 46
175 lines (147 loc) · 6.61 KB
/
Copy pathrelease.yml
File metadata and controls
175 lines (147 loc) · 6.61 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
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: Release VRCT
on:
push:
tags:
- 'v*' # タグが 'v' で始まる場合にトリガー (例: v1.0.0)
jobs:
release:
name: Build VRCT
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version from tag
id: get_version
shell: pwsh
run: |
$TAG_WITH_V = $env:GITHUB_REF -replace "^refs/tags/", ""
$VERSION_NUM = $TAG_WITH_V -replace "^v", ""
echo "VERSION=$VERSION_NUM" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Determine release channel
id: channel
shell: pwsh
run: |
if ("${{ github.ref_name }}" -match "-(beta|rc)") {
echo "is_beta=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "hf_repo=ms-software/VRCT-beta" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
} else {
echo "is_beta=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "hf_repo=ms-software/VRCT" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
}
- name: Verify version numbers match the tag
shell: pwsh
run: |
$expected = $env:VERSION
$failed = $false
$pkgVersion = (Get-Content package.json -Raw | ConvertFrom-Json).version
if ($pkgVersion -ne $expected) {
Write-Host "::error::package.json version ($pkgVersion) does not match tag version ($expected)"
$failed = $true
}
$tauriVersion = (Get-Content src-tauri/tauri.conf.json -Raw | ConvertFrom-Json).version
if ($tauriVersion -ne $expected) {
Write-Host "::error::src-tauri/tauri.conf.json version ($tauriVersion) does not match tag version ($expected)"
$failed = $true
}
$configContent = Get-Content src-python/config.py -Raw
if ($configContent -notmatch 'self\._VERSION\s*=\s*"([^"]+)"') {
Write-Host "::error::could not find self._VERSION in src-python/config.py"
$failed = $true
} elseif ($Matches[1] -ne $expected) {
Write-Host "::error::src-python/config.py VERSION ($($Matches[1])) does not match tag version ($expected)"
$failed = $true
}
if ($failed) {
Write-Host "::error::Version mismatch detected. Bump every version field to $expected before tagging."
exit 1
}
- name: Verify build channel matches the tag
shell: pwsh
run: |
$isBeta = "${{ steps.channel.outputs.is_beta }}" -eq "true"
$expectedChannel = if ($isBeta) { "beta" } else { "stable" }
$content = Get-Content src-python/build_channel.py -Raw
if ($content -notmatch 'BUILD_CHANNEL\s*=\s*"([^"]+)"') {
Write-Host "::error::could not find BUILD_CHANNEL in src-python/build_channel.py"
exit 1
}
$actualChannel = $Matches[1]
if ($actualChannel -ne $expectedChannel) {
Write-Host "::error::BUILD_CHANNEL is '$actualChannel' but tag '${{ github.ref_name }}' implies '$expectedChannel'. Fix src-python/build_channel.py before tagging."
exit 1
}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22.15.0'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install dependencies
run: npm install
- name: Setup Python environment
run: npm run setup-python
- name: Install Python script dependencies
run: pip install tqdm
- name: Build and package
run: npm run release-all
- name: Compute SHA-256 of the installer
id: sha256
shell: pwsh
run: |
$exePath = "./src-tauri/target/release/bundle/nsis/VRCT_${{ env.VERSION }}_x64-setup.exe"
$shaPath = "./src-tauri/target/release/bundle/nsis/VRCT_${{ env.VERSION }}_x64-setup.exe.sha256"
$hash = (Get-FileHash -Path $exePath -Algorithm SHA256).Hash.ToLower()
Set-Content -Path $shaPath -Value $hash -NoNewline -Encoding ascii
echo "sha_path=$shaPath" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Upload to Hugging Face Hub
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
shell: pwsh
run: |
pip install huggingface_hub==0.34.4
$UPLOAD_DIR = "./hf_upload_temp"
New-Item -ItemType Directory -Force -Path $UPLOAD_DIR
Copy-Item -Path ./VRCT.zip -Destination "$UPLOAD_DIR/VRCT.zip"
Copy-Item -Path ./VRCT_cuda.zip -Destination "$UPLOAD_DIR/VRCT_cuda.zip"
Copy-Item -Path "./src-tauri/target/release/bundle/nsis/VRCT_${{ env.VERSION }}_x64-setup.exe" -Destination "$UPLOAD_DIR/VRCT_setup.exe"
hf upload --repo-type model --commit-message "👍️[Update] ${{ env.VERSION }} Release" ${{ steps.channel.outputs.hf_repo }} $UPLOAD_DIR
hf repo tag create ${{ steps.channel.outputs.hf_repo }} ${{ github.ref_name }} --repo-type model --message "Release ${{ github.ref_name }}"
Remove-Item -Recurse -Force $UPLOAD_DIR
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ env.VERSION }}
draft: false
prerelease: ${{ steps.channel.outputs.is_beta }}
- name: Upload Release Asset (NSIS Installer)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./src-tauri/target/release/bundle/nsis/VRCT_${{ env.VERSION }}_x64-setup.exe
asset_name: VRCT_${{ env.VERSION }}_x64-setup.exe
asset_content_type: application/octet-stream
- name: Upload Release Asset (SHA-256 checksum)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.sha256.outputs.sha_path }}
asset_name: VRCT_${{ env.VERSION }}_x64-setup.exe.sha256
asset_content_type: text/plain