Skip to content

Commit 35f2aba

Browse files
authored
Merge pull request #88 from AlistGo/okatu-loli-patch-3
Refactor release_beta.yml for macOS and cleanup
2 parents 5bb32da + 6eaf4c2 commit 35f2aba

1 file changed

Lines changed: 27 additions & 5 deletions

File tree

.github/workflows/release_beta.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ jobs:
4646
- os: windows-latest
4747
target: aarch64-pc-windows-msvc
4848
args: --bundles nsis,updater
49-
# - os: ubuntu-20.04
50-
# target: aarch64-unknown-linux-gnu
5149

5250
runs-on: ${{ matrix.os }}
5351
steps:
@@ -58,7 +56,7 @@ jobs:
5856
token: ${{ secrets.MY_TOKEN }}
5957

6058
- name: Install dependencies (ubuntu only)
61-
if: matrix.os == 'ubuntu-22.04'
59+
if: ${{ matrix.os == 'ubuntu-22.04' }}
6260
run: |
6361
sudo apt-get update
6462
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev
@@ -109,8 +107,32 @@ jobs:
109107
ALIST_VERSION: beta
110108
RCLONE_VERSION: ${{ steps.get-rclone-version.outputs.tag_name }}
111109

110+
- name: Clean conflicting macOS app tarballs
111+
if: ${{ contains(matrix.target, 'apple-darwin') }}
112+
uses: actions/github-script@v7
113+
with:
114+
github-token: ${{ secrets.MY_TOKEN }}
115+
script: |
116+
const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");
117+
const tag = "beta";
118+
const target = "${{ matrix.target }}";
119+
const patterns =
120+
target === "x86_64-apple-darwin"
121+
? [/^alist-desktop_darwin_x64\.app\.tar\.gz$/, /^alist-desktop_darwin_x64\.app\.tar\.gz\.sig$/]
122+
: target === "aarch64-apple-darwin"
123+
? [/^alist-desktop_darwin_aarch64\.app\.tar\.gz$/, /^alist-desktop_darwin_aarch64\.app\.tar\.gz\.sig$/]
124+
: [];
125+
if (patterns.length === 0) return;
126+
const rel = await github.rest.repos.getReleaseByTag({ owner, repo, tag });
127+
const assets = await github.paginate(github.rest.repos.listReleaseAssets, { owner, repo, release_id: rel.data.id, per_page: 100 });
128+
for (const a of assets) {
129+
if (patterns.some(rx => rx.test(a.name))) {
130+
await github.rest.repos.deleteReleaseAsset({ owner, repo, asset_id: a.id });
131+
}
132+
}
133+
112134
- name: Build & publish (coordinator uploads latest.json)
113-
if: matrix.os == 'macos-latest' && matrix.target == 'x86_64-apple-darwin'
135+
if: ${{ matrix.os == 'macos-latest' && matrix.target == 'x86_64-apple-darwin' }}
114136
uses: tauri-apps/tauri-action@v0
115137
env:
116138
GITHUB_TOKEN: ${{ secrets.MY_TOKEN }}
@@ -159,7 +181,7 @@ jobs:
159181
run: |
160182
npx tsx ./proxy.ts
161183
162-
- name: Upload proxy.json (override existing)
184+
- name: Upload proxy.json
163185
uses: softprops/action-gh-release@v2
164186
with:
165187
token: ${{ secrets.MY_TOKEN }}

0 commit comments

Comments
 (0)