Skip to content

Commit e154258

Browse files
authored
Merge pull request #17 from alist-dev/main
2 parents 9184f42 + 7ff43af commit e154258

File tree

4 files changed

+107
-41
lines changed

4 files changed

+107
-41
lines changed

.github/workflows/release.yml

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,38 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
platform: [macos-latest, ubuntu-20.04, windows-latest]
14-
runs-on: ${{ matrix.platform }}
13+
include:
14+
- os: macos-latest
15+
target: x86_64-apple-darwin
16+
- os: ubuntu-20.04
17+
target: x86_64-unknown-linux-gnu
18+
- os: windows-latest
19+
target: x86_64-pc-windows-msvc
20+
- os: macos-latest
21+
target: aarch64-apple-darwin
22+
# - os: ubuntu-20.04
23+
# target: aarch64-unknown-linux-gnu
24+
25+
runs-on: ${{ matrix.os }}
1526
steps:
1627
- name: Checkout repository
1728
uses: actions/checkout@v3
1829
with:
19-
repository: alist-org/desktop
30+
repository: alist-dev/desktop
2031
token: ${{ secrets.MY_TOKEN }}
2132

2233
- name: Install dependencies (ubuntu only)
23-
if: matrix.platform == 'ubuntu-20.04'
34+
if: matrix.os == 'ubuntu-20.04'
2435
# You can remove libayatana-appindicator3-dev if you don't use the system tray feature.
2536
run: |
2637
sudo apt-get update
2738
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev
39+
# sudo apt-get install -y libssl-dev pkg-config gcc-10-aarch64-linux-gnu
2840
2941
- name: Rust setup
3042
uses: dtolnay/rust-toolchain@stable
43+
with:
44+
targets: ${{ matrix.target }}
3145

3246
- name: Rust cache
3347
uses: swatinem/rust-cache@v2
@@ -55,34 +69,47 @@ jobs:
5569
env:
5670
AD_VERSION: ${{ github.ref_name }}
5771

72+
- name: Get AList version
73+
id: get-alist-version
74+
uses: fangqiuming/latest-release-version@v1.2.0-beta
75+
with:
76+
repository: alist-org/alist
77+
token: ${{ secrets.GITHUB_TOKEN }}
78+
79+
- name: Get Rclone version
80+
id: get-rclone-version
81+
uses: fangqiuming/latest-release-version@v1.2.0-beta
82+
with:
83+
repository: rclone/rclone
84+
token: ${{ secrets.GITHUB_TOKEN }}
85+
5886
- name: Download sidecar
5987
run: npx tsx ./scripts/bin.ts
60-
env:
61-
ALIST_DESKTOP_SECRET: ${{ secrets.ALIST_DESKTOP_SECRET }}
88+
env:
89+
TARGET_TRIPLE: ${{ matrix.target }}
90+
ALIST_VERSION: ${{ steps.get-alist-version.outputs.tag_name }} # v3.19.0
91+
RCLONE_VERSION: ${{ steps.get-rclone-version.outputs.tag_name }} # v1.63.0
6292

6393
- name: Build the app
6494
uses: tauri-apps/tauri-action@v0
6595
env:
6696
GITHUB_TOKEN: ${{ secrets.MY_TOKEN }}
6797
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
98+
# PKG_CONFIG_ALLOW_CROSS: ${{ contains(matrix.target, 'aarch64') && '1' || '' }}
6899
with:
69100
tagName: ${{ github.ref_name }} # This only works if your workflow triggers on new tags.
70-
releaseName: 'AList Desktop v__VERSION__' # tauri-action replaces \_\_VERSION\_\_ with the app version.
71-
releaseBody: 'See the assets to download and install this version.'
101+
releaseName: "AList Desktop v__VERSION__" # tauri-action replaces \_\_VERSION\_\_ with the app version.
102+
releaseBody: "See the assets to download and install this version."
103+
args: "--target ${{ matrix.target }}"
72104

73105
build_updater:
74106
name: "Build updater"
75107
needs: release
76108
environment: ${{ github.event.inputs.environment || 'Beta' }}
77109
runs-on: ubuntu-latest
78-
outputs:
79-
release_id: ${{ steps.create_release.outputs.id }}
80110
steps:
81111
- name: Checkout repository
82112
uses: actions/checkout@v3
83-
with:
84-
repository: alist-org/desktop
85-
token: ${{ secrets.MY_TOKEN }}
86113

87114
- uses: pnpm/action-setup@v2
88115
with:
@@ -95,37 +122,15 @@ jobs:
95122
node-version: "lts/*"
96123
# cache: "pnpm" # Set this to npm, yarn or pnpm.
97124

98-
- name: Replace version
125+
- name: Generate proxy.json
99126
run: |
100-
npx tsx ./scripts/version.ts
101-
cat src-tauri/tauri.conf.json
102-
env:
103-
AD_VERSION: ${{ github.ref_name }}
104-
105-
- name: Build alist-desktop.json with proxy
106-
run: |
107-
npx tsx ./scripts/updater.ts
108-
cat alist-desktop.json
109-
mv alist-desktop.json alist-desktop-proxy.json
110-
env:
111-
BASE: https://ghproxy.com/https://github.com/alist-org/desktop-release
127+
npx tsx ./proxy.ts
128+
cat proxy.json
112129
113-
- name: Build alist-desktop.json
114-
run: |
115-
npx tsx ./scripts/updater.ts
116-
cat alist-desktop.json
117-
118-
- name: Replace signature
119-
run: |
120-
npx tsx ./scripts/sign.ts
121-
cat alist-desktop.json
122-
cat alist-desktop-proxy.json
123-
124-
- name: Create release and Upload alist-desktop.json
125-
id: create_release
130+
- name: Upload proxy.json
126131
uses: softprops/action-gh-release@v1
127132
with:
128133
fail_on_unmatched_files: true
134+
token: ${{ secrets.MY_TOKEN }}
129135
files: |
130-
alist-desktop.json
131-
alist-desktop-proxy.json
136+
proxy.json

package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "desktop-release",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"devDependencies": {
13+
"@types/node": "^20.3.3"
14+
}
15+
}

pnpm-lock.yaml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proxy.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import fs from "fs";
2+
3+
interface Updater {
4+
name: string;
5+
notes: string;
6+
pub_date: string;
7+
platforms: {
8+
[platform: string]: {
9+
url: string;
10+
signature: string;
11+
};
12+
};
13+
}
14+
15+
// console.log(process.env);
16+
17+
const repo = process.env.GITHUB_REPOSITORY!;
18+
19+
const generateProxy = async () => {
20+
const res = await fetch(
21+
`https://github.com/${repo}/releases/latest/download/latest.json`
22+
);
23+
const content = await res.json();
24+
const updater: Updater = content;
25+
const { platforms } = updater;
26+
for (const plat in platforms) {
27+
const raw_url = platforms[plat].url;
28+
platforms[plat].url = "https://ghproxy.com/" + raw_url;
29+
}
30+
fs.writeFileSync("proxy.json", JSON.stringify(updater, null, 2));
31+
};
32+
33+
generateProxy();

0 commit comments

Comments
 (0)