Trigger build for c20da5ac27b68001eca205944ae8b560661c3ac0 #180
This file contains hidden or 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
| name: Release Beta | |
| on: | |
| push: | |
| branches: | |
| - main | |
| issue_comment: | |
| types: [created] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| update_beta_ref: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name != 'issue_comment' || (github.event.issue.number == 69 && contains(github.event.comment.body, '/release-beta')) }} | |
| steps: | |
| - name: Create or update ref | |
| id: create-or-update-ref | |
| uses: ovsds/create-or-update-ref-action@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.MY_TOKEN }} | |
| with: | |
| ref: refs/tags/beta | |
| sha: ${{ github.sha }} | |
| release_beta: | |
| needs: update_beta_ref | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| args: | |
| - os: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| args: | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| args: --bundles nsis,updater | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| args: | |
| - os: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| args: --bundles nsis,updater | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: AlistGo/desktop | |
| token: ${{ secrets.MY_TOKEN }} | |
| - name: Install dependencies (ubuntu only) | |
| if: ${{ matrix.os == 'ubuntu-22.04' }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev | |
| - name: Rust setup | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Rust cache | |
| uses: swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "./src-tauri -> target" | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 9 | |
| run_install: false | |
| - name: Sync node version and setup cache | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "lts/*" | |
| cache: "pnpm" | |
| - name: Install app dependencies and build web | |
| run: pnpm i | |
| - name: Replace version | |
| run: | | |
| npx tsx ./scripts/beta_version.ts | |
| cat src-tauri/tauri.conf.json | |
| env: | |
| AD_VERSION: ${{ github.ref_name }} | |
| TARGET_TRIPLE: ${{ matrix.target }} | |
| - name: Get Rclone version | |
| id: get-rclone-version | |
| uses: fangqiuming/latest-release-version@v1.2.0-beta | |
| with: | |
| repository: rclone/rclone | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Download sidecar | |
| run: npx tsx ./scripts/bin.ts | |
| env: | |
| TARGET_TRIPLE: ${{ matrix.target }} | |
| ALIST_VERSION: beta | |
| RCLONE_VERSION: ${{ steps.get-rclone-version.outputs.tag_name }} | |
| - name: Clean conflicting macOS app tarballs | |
| if: ${{ contains(matrix.target, 'apple-darwin') }} | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.MY_TOKEN }} | |
| script: | | |
| const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/"); | |
| const tag = "beta"; | |
| const target = "${{ matrix.target }}"; | |
| const patterns = | |
| target === "x86_64-apple-darwin" | |
| ? [/^alist-desktop_darwin_x64\.app\.tar\.gz$/, /^alist-desktop_darwin_x64\.app\.tar\.gz\.sig$/] | |
| : target === "aarch64-apple-darwin" | |
| ? [/^alist-desktop_darwin_aarch64\.app\.tar\.gz$/, /^alist-desktop_darwin_aarch64\.app\.tar\.gz\.sig$/] | |
| : []; | |
| if (patterns.length === 0) return; | |
| const rel = await github.rest.repos.getReleaseByTag({ owner, repo, tag }); | |
| const assets = await github.paginate(github.rest.repos.listReleaseAssets, { owner, repo, release_id: rel.data.id, per_page: 100 }); | |
| for (const a of assets) { | |
| if (patterns.some(rx => rx.test(a.name))) { | |
| await github.rest.repos.deleteReleaseAsset({ owner, repo, asset_id: a.id }); | |
| } | |
| } | |
| - name: Build & publish (coordinator uploads latest.json) | |
| if: ${{ matrix.os == 'macos-latest' && matrix.target == 'x86_64-apple-darwin' }} | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.MY_TOKEN }} | |
| TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
| with: | |
| releaseName: "AList Desktop v__VERSION__" | |
| releaseBody: "See the assets to download and install this version." | |
| args: "--target ${{ matrix.target }} ${{ matrix.args }}" | |
| prerelease: true | |
| tagName: beta | |
| - name: Build & publish (no updater json) | |
| if: ${{ !(matrix.os == 'macos-latest' && matrix.target == 'x86_64-apple-darwin') }} | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.MY_TOKEN }} | |
| TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
| with: | |
| releaseName: "AList Desktop v__VERSION__" | |
| releaseBody: "See the assets to download and install this version." | |
| args: "--target ${{ matrix.target }} ${{ matrix.args }}" | |
| prerelease: true | |
| tagName: beta | |
| includeUpdaterJson: false | |
| build_updater: | |
| name: "Build updater beta" | |
| needs: release_beta | |
| environment: ${{ github.event.inputs.environment || 'Beta' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: main | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 9 | |
| run_install: false | |
| - name: Sync node version and setup cache | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "lts/*" | |
| - name: Generate proxy.json | |
| run: | | |
| npx tsx ./proxy.ts | |
| - name: Upload proxy.json | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| token: ${{ secrets.MY_TOKEN }} | |
| tag_name: beta | |
| prerelease: true | |
| make_latest: false | |
| allow_updates: true | |
| fail_on_unmatched_files: true | |
| files: | | |
| *.proxy.json |