Skip to content

Commit

Permalink
feat. Updater (untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
btjawa committed Dec 31, 2023
1 parent f60f24c commit 5eed76b
Show file tree
Hide file tree
Showing 7 changed files with 518 additions and 7 deletions.
45 changes: 41 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ name: Release CI

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*'
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
create-release:
Expand All @@ -27,9 +28,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: '${{ steps.get_version.outputs.VERSION }}'
release_name: 'app ${{ 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
strategy:
Expand Down Expand Up @@ -77,5 +78,41 @@ jobs:
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout btjawa/BiliTools repository
uses: actions/checkout@v2
with:
releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }}
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
261 changes: 259 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"description": "Download Videos/Covers/Audios/Danmakus... All in one!",
"type": "module",
"scripts": {
"tauri": "tauri"
"tauri": "tauri",
"updater": "node scripts/updater.mjs",
"release": "node scripts/release.mjs"
},
"repository": {
"type": "git",
Expand All @@ -19,5 +21,9 @@
"devDependencies": {
"@tauri-apps/api": "^1.5.1",
"@tauri-apps/cli": "^1.5.6"
},
"dependencies": {
"@actions/github": "^6.0.0",
"node-fetch": "^3.3.2"
}
}
Loading

0 comments on commit 5eed76b

Please sign in to comment.