|
| 1 | +name: Publish desktop app |
| 2 | +# on: |
| 3 | +# pull_request: |
| 4 | +# types: [closed] |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - '**' # 匹配所有分支 |
| 10 | + |
| 11 | +jobs: |
| 12 | + publish: |
| 13 | + permissions: |
| 14 | + contents: write |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - platform: 'macos-latest' # for Arm based macs (M1 and above). |
| 20 | + args: '--target aarch64-apple-darwin' |
| 21 | + - platform: 'macos-latest' # for Intel based macs. |
| 22 | + args: '--target x86_64-apple-darwin' |
| 23 | + - platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. |
| 24 | + args: '' |
| 25 | + - platform: 'windows-latest' |
| 26 | + args: '' |
| 27 | + |
| 28 | + runs-on: ubuntu-latest |
| 29 | + # 当具有 release 标签的 PR 被合并时,自动发布包版本 |
| 30 | + if: contains(github.event.pull_request.labels.*.name, 'release') && github.event.pull_request.merged == true |
| 31 | + |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v3 |
| 34 | + |
| 35 | + - name: Install Node.js |
| 36 | + uses: actions/setup-node@v3 |
| 37 | + with: |
| 38 | + node-version: 18 |
| 39 | + |
| 40 | + - name: install Rust stable |
| 41 | + uses: dtolnay/rust-toolchain@stable |
| 42 | + with: |
| 43 | + # Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. |
| 44 | + targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} |
| 45 | + |
| 46 | + - name: install dependencies (ubuntu only) |
| 47 | + if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above. |
| 48 | + run: | |
| 49 | + sudo apt-get update |
| 50 | + sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf |
| 51 | + # webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2. |
| 52 | + # You can remove the one that doesn't apply to your app to speed up the workflow a bit. |
| 53 | + |
| 54 | + - name: Install pnpm |
| 55 | + uses: pnpm/action-setup@v4 |
| 56 | + with: |
| 57 | + run_install: false |
| 58 | + |
| 59 | + - name: Cache pnpm modules |
| 60 | + uses: actions/cache@v3 |
| 61 | + with: |
| 62 | + path: | |
| 63 | + .pnpm-store |
| 64 | + node_modules |
| 65 | + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 66 | + restore-keys: | |
| 67 | + ${{ runner.os }}-pnpm- |
| 68 | +
|
| 69 | + - name: Install dependencies |
| 70 | + run: pnpm install |
| 71 | + |
| 72 | + - name: build front-end assets |
| 73 | + run: npm run build:portal:desktop |
| 74 | + |
| 75 | + - uses: tauri-apps/tauri-action@v0 |
| 76 | + env: |
| 77 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 78 | + with: |
| 79 | + tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. |
| 80 | + releaseName: 'App v__VERSION__' |
| 81 | + releaseBody: 'See the assets to download this version and install.' |
| 82 | + releaseDraft: true |
| 83 | + prerelease: false |
| 84 | + args: ${{ matrix.args }} |
0 commit comments