1
0
mirror of https://github.com/wangdage12/Snap.Hutao.git synced 2026-03-28 05:52:16 +08:00
Files
Snap.Hutao/.github/workflows/PublishDistribution.yml
dependabot[bot] 1dabff07a1 Bump benc-uk/workflow-dispatch from 1.2.4 to 1.3.1 in /.github/workflows
Bumps [benc-uk/workflow-dispatch](https://github.com/benc-uk/workflow-dispatch) from 1.2.4 to 1.3.1.
- [Release notes](https://github.com/benc-uk/workflow-dispatch/releases)
- [Commits](https://github.com/benc-uk/workflow-dispatch/compare/v1.2.4...v1.3.1)

---
updated-dependencies:
- dependency-name: benc-uk/workflow-dispatch
  dependency-version: 1.3.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-23 02:57:49 +00:00

74 lines
2.5 KiB
YAML

name: PublishDistribution
on:
release:
types: [released]
workflow_dispatch:
jobs:
Publish:
runs-on: ubuntu-latest
steps:
# Purge Patch System Cache
- name: Purge Patch
env:
PURGE_URL: ${{ secrets.PURGE_URL }}
run: |
curl -X PATCH $PURGE_URL
- name: Overwrite CN patch mirrors
shell: pwsh
run: |
$latestRelease = Invoke-RestMethod -Uri "https://api.github.com/repos/DGP-Studio/Snap.Hutao/releases/latest"
$asset = $latestRelease.assets[0]
$assetUrl = "https://ghproxy.qhy04.cc/" + $asset.browser_download_url
$tagName = $latestRelease.tag_name
Write-Output "Waiting Patch API to update"
while ($true) {
$patchData = Invoke-RestMethod -Uri "https://api.snapgenshin.com/patch/hutao"
$cachedVersion = $patchData.data.version.Substring(0, $patchData.data.version.Length - 2)
if ($cachedVersion -eq $tagName) {
break
}
Start-Sleep -Seconds 3
}
Write-Output "Add GitHub Proxy to Patch API"
$mirrorData = @{
key = "snap-hutao"
url = $assetUrl
mirror_name = "GitHub Proxy"
mirror_type = "direct"
} | ConvertTo-Json
$response1 = Invoke-WebRequest -Uri "https://api.snapgenshin.com/patch/mirror" `
-Method POST `
-Headers @{"API-Token" = "${{ secrets.OVERWRITE_TOKEN }}"} `
-Body $mirrorData `
-ContentType "application/json"
Write-Output $response1.Content
Write-Output "Add R2 to Patch API"
$r2Url = "https://hutao-dist.qhy04.cc/$($asset.name)"
$r2Data = @{
key = "snap-hutao"
url = $r2Url
mirror_name = "Cloudflare R2"
mirror_type = "direct"
} | ConvertTo-Json
$response2 = Invoke-WebRequest -Uri "https://api.snapgenshin.com/patch/mirror" `
-Method POST `
-Headers @{"API-Token" = "${{ secrets.OVERWRITE_TOKEN }}"} `
-Body $r2Data `
-ContentType "application/json"
Write-Output $response2.Content
- uses: benc-uk/workflow-dispatch@v1.3.1
with:
workflow: Build
repo: DGP-Studio/hutao-installer
ref: main
token: "${{ secrets.RUNNER_CHECK_TOKEN }}"
inputs: '{ "only-offline": true }'