-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
90 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,39 @@ | ||
name: Release CI | ||
|
||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
workflow_dispatch: | ||
|
||
jobs: | ||
create-release: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Query version number | ||
id: get_version | ||
shell: bash | ||
run: | | ||
echo "using version tag ${GITHUB_REF:10}" | ||
echo ::set-output name=version::"${GITHUB_REF:10}" | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: '${{ steps.get_version.outputs.VERSION }}' | ||
release_name: 'BiliTools | ${{ steps.get_version.outputs.VERSION }}' | ||
body: 'See the assets to download this version and install.' | ||
|
||
build-tauri: | ||
needs: create-release | ||
permissions: | ||
contents: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [macos-latest, ubuntu-latest, windows-latest] | ||
# platform: [macos-latest, ubuntu-20.04, windows-latest] | ||
platform: [windows-latest] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Checkout original repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: master | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
node-version: 18 | ||
|
||
- name: Install Rust stable | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
|
||
# Rust cache | ||
- uses: Swatinem/rust-cache@v1 | ||
|
||
- name: install dependencies (ubuntu only) | ||
|
@@ -60,59 +42,35 @@ jobs: | |
sudo apt-get update | ||
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | ||
|
||
- name: Yarn cache | ||
- name: Get npm cache directory path | ||
id: npm-cache-dir-path | ||
run: echo "::set-output name=dir::$(npm config get cache)" | ||
- name: Npm cache | ||
uses: actions/cache@v2 | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
path: ${{ steps.npm-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
${{ runner.os }}-npm- | ||
- name: Install app dependencies | ||
run: npm install | ||
|
||
- name: Install app dependencies and build it | ||
run: yarn && yarn build | ||
- uses: tauri-apps/tauri-action@v0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | ||
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | ||
with: | ||
releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }} | ||
|
||
# 生成静态资源并将其推送到公仓 | ||
updater: | ||
runs-on: ubuntu-latest | ||
needs: [create-release, build-tauri] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: yarn | ||
- run: yarn updater | ||
tagName: v__VERSION__ | ||
releaseName: 'BiliTools | v__VERSION__' | ||
releaseBody: 'See the assets to download this version and install.' | ||
releaseDraft: false | ||
prerelease: false | ||
includeUpdaterJson: false | ||
|
||
- name: Init and deploy install.json | ||
run: npm run updater | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Checkout btjawa/BiliTools repository | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: btjawa/BiliTools | ||
token: ${{ secrets.PAT }} | ||
path: 'BiliTools' | ||
fetch-depth: 0 # 确保获取所有历史记录以便正确定位分支 | ||
|
||
- name: Copy files to BiliTools repository | ||
run: | | ||
cp -r ./updater/* ./BiliTools/ | ||
- name: Commit and push to updater branch | ||
run: | | ||
cd BiliTools | ||
git checkout updater || git checkout -b updater | ||
git config --global user.name 'GitHub Actions' | ||
git config --global user.email '[email protected]' | ||
git add . | ||
git commit -m "Update updater branch" | ||
git push --set-upstream origin updater | ||
GITHUB_TOKEN: ${{ secrets.PAT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,8 @@ dist-ssr | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
assets/* | ||
assets/* | ||
!assets/preview.png | ||
|
||
png_to_ico.exe | ||
test.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Updater Log | ||
|
||
## v1.0.0 | ||
|
||
更名为 "BiliTools", 全新图标 | ||
- 功能: 下载相关 | ||
- 支持 8K & Hi-Res无损 & 杜比视界 + 全景声 & 编码格式 | ||
- 并发下载, 多个视频将会打包在一个文件夹内 | ||
- 功能: 登录相关 | ||
- 个人主页 | ||
- 扫码 & 密码 & 短信登录 + 自动刷新登录状态 | ||
- 功能: 杂项更新 | ||
- 现在可以设置了 - 引入配置文件 | ||
- 自动检测新版本并更新 | ||
- 修复: 提高操作安全性 - 不再使用反代服务器解决CORS |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import fetch from 'node-fetch'; | ||
import { getOctokit, context } from '@actions/github'; | ||
import { execSync } from 'child_process'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
import updatelog from './updatelog.mjs'; | ||
|
||
|
@@ -43,11 +45,6 @@ async function updater() { | |
pub_date: new Date().toISOString(), | ||
platforms: { | ||
win64: { signature: '', url: '' }, // compatible with older formats | ||
linux: { signature: '', url: '' }, // compatible with older formats | ||
darwin: { signature: '', url: '' }, // compatible with older formats | ||
'darwin-aarch64': { signature: '', url: '' }, | ||
'darwin-x86_64': { signature: '', url: '' }, | ||
'linux-x86_64': { signature: '', url: '' }, | ||
'windows-x86_64': { signature: '', url: '' }, | ||
// 'windows-i686': { signature: '', url: '' }, // no supported | ||
}, | ||
|
@@ -56,7 +53,7 @@ async function updater() { | |
const setAsset = async (asset, reg, platforms) => { | ||
let sig = ''; | ||
if (/.sig$/.test(asset.name)) { | ||
sig = await getSignature(asset.browser_download_url); | ||
sig = await getSignature(`https://gh.con.sh/${asset.browser_download_url}`); | ||
} | ||
platforms.forEach((platform) => { | ||
if (reg.test(asset.name)) { | ||
|
@@ -66,37 +63,29 @@ async function updater() { | |
return; | ||
} | ||
// 设置下载链接 | ||
updateData.platforms[platform].url = asset.browser_download_url; | ||
updateData.platforms[platform].url = `https://gh.con.sh/${asset.browser_download_url}`; | ||
} | ||
}); | ||
}; | ||
|
||
const promises = latestRelease.assets.map(async (asset) => { | ||
// windows | ||
await setAsset(asset, /.msi.zip/, ['win64', 'windows-x86_64']); | ||
|
||
// darwin | ||
await setAsset(asset, /.app.tar.gz/, [ | ||
'darwin', | ||
'darwin-x86_64', | ||
'darwin-aarch64', | ||
]); | ||
|
||
// linux | ||
await setAsset(asset, /.AppImage.tar.gz/, ['linux', 'linux-x86_64']); | ||
}); | ||
await Promise.allSettled(promises); | ||
|
||
if (!fs.existsSync('updater')) { | ||
fs.mkdirSync('updater'); | ||
} | ||
|
||
// 将数据写入文件 | ||
fs.writeFileSync( | ||
'./updater/install.json', | ||
path.join(process.cwd(), 'install.json'), | ||
JSON.stringify(updateData, null, 2) | ||
); | ||
console.log('Generate updater/install.json'); | ||
console.log('Generate install.json'); | ||
execSync('git config user.name github-actions'); | ||
execSync('git config user.email [email protected]'); | ||
execSync('git add -A'); | ||
execSync(`git commit -m "Update install.json"`); | ||
execSync(`git push origin HEAD:master`); | ||
console.log(`Publish Successfully...`); | ||
} | ||
|
||
updater().catch(console.error); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters