forked from bs-community/blessing-skin-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.ps1
32 lines (24 loc) · 972 Bytes
/
publish.ps1
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
if (!(Test-Path updated.json)) {
exit
}
git config --global user.name 'Pig Fang'
git config --global user.email '[email protected]'
$token = $env:GH_TOKEN
Set-Location .dist
git add .
$shouldUpdate = git status -s
if ($shouldUpdate) {
git commit -m "Publish"
git remote set-url origin "https://tadaf:[email protected]/bs-community/plugins-dist.git"
git push origin master
}
Set-Location '..'
$botRelease = (Invoke-WebRequest 'https://api.github.com/repos/bs-community/telegram-bot/releases/latest').Content | ConvertFrom-Json
$botBinUrl = ((Invoke-WebRequest $botRelease.assets_url).Content | ConvertFrom-Json).browser_download_url
bash -c "curl -fSL $botBinUrl -o bot"
chmod +x ./bot
./bot plugin updated.json
foreach ($lang in 'en', 'zh_CN') {
Invoke-WebRequest "https://purge.jsdelivr.net/gh/bs-community/plugins-dist@latest/registry_$lang.json"
}
Invoke-WebRequest 'https://purge.jsdelivr.net/gh/bs-community/plugins-dist@latest/registry.json'