|
1 | | -name: 'publish' |
| 1 | +name: "publish" |
2 | 2 |
|
3 | 3 | on: pull_request |
4 | 4 |
|
5 | 5 | jobs: |
6 | | - create-release: |
7 | | - permissions: |
8 | | - contents: write |
9 | | - runs-on: ubuntu-20.04 |
10 | | - outputs: |
11 | | - release_id: ${{ steps.create-release.outputs.result }} |
12 | | - |
13 | | - steps: |
14 | | - - uses: actions/checkout@v3 |
15 | | - - name: setup node |
16 | | - uses: actions/setup-node@v3 |
17 | | - with: |
18 | | - node-version: 16 |
19 | | - - name: get version |
20 | | - run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV |
21 | | - - name: create release |
22 | | - id: create-release |
23 | | - uses: actions/github-script@v6 |
24 | | - with: |
25 | | - script: | |
26 | | - const { data } = await github.rest.repos.createRelease({ |
27 | | - owner: context.repo.owner, |
28 | | - repo: context.repo.repo, |
29 | | - tag_name: `release-${process.env.PACKAGE_VERSION}`, |
30 | | - name: `Outliner ${process.env.PACKAGE_VERSION}`, |
31 | | - body: 'Take a look at the assets to download and install this app.', |
32 | | - draft: true, |
33 | | - prerelease: false |
34 | | - }) |
35 | | - return data.id |
36 | | -
|
37 | | - build-tauri: |
38 | | - needs: create-release |
| 6 | + publish-tauri: |
39 | 7 | permissions: |
40 | 8 | contents: write |
41 | 9 | strategy: |
42 | 10 | fail-fast: false |
43 | 11 | matrix: |
44 | | - platform: [macos-latest, ubuntu-20.04, windows-latest] |
| 12 | + include: |
| 13 | + - platform: "macos-latest" # for Arm based macs (M1 and above). |
| 14 | + args: "--target aarch64-apple-darwin" |
| 15 | + - platform: "macos-latest" # for Intel based macs. |
| 16 | + args: "--target x86_64-apple-darwin" |
| 17 | + - platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04. |
| 18 | + args: "" |
| 19 | + - platform: "windows-latest" |
| 20 | + args: "" |
45 | 21 |
|
46 | 22 | runs-on: ${{ matrix.platform }} |
47 | 23 | steps: |
48 | | - - uses: actions/checkout@v3 |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + |
49 | 26 | - name: setup node |
50 | | - uses: actions/setup-node@v3 |
| 27 | + uses: actions/setup-node@v4 |
51 | 28 | with: |
52 | | - node-version: 16 |
| 29 | + node-version: lts/* |
| 30 | + |
53 | 31 | - name: install Rust stable |
54 | 32 | uses: dtolnay/rust-toolchain@stable |
| 33 | + with: |
| 34 | + # Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. |
| 35 | + targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} |
| 36 | + |
55 | 37 | - name: install dependencies (ubuntu only) |
56 | | - if: matrix.platform == 'ubuntu-20.04' |
| 38 | + if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above. |
57 | 39 | run: | |
58 | 40 | sudo apt-get update |
59 | | - sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf |
| 41 | + sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf |
| 42 | + # webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2. |
| 43 | + # You can remove the one that doesn't apply to your app to speed up the workflow a bit. |
| 44 | + |
60 | 45 | - name: install frontend dependencies |
61 | | - run: yarn install # change this to npm or pnpm depending on which one you use |
| 46 | + run: yarn install # change this to npm, pnpm or bun depending on which one you use. |
| 47 | + |
62 | 48 | - uses: tauri-apps/tauri-action@v0 |
63 | 49 | env: |
64 | 50 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
65 | 51 | with: |
66 | | - releaseId: ${{ needs.create-release.outputs.release_id }} |
67 | | - |
68 | | - publish-release: |
69 | | - permissions: |
70 | | - contents: write |
71 | | - runs-on: ubuntu-20.04 |
72 | | - needs: [create-release, build-tauri] |
73 | | - |
74 | | - steps: |
75 | | - - name: publish release |
76 | | - id: publish-release |
77 | | - uses: actions/github-script@v6 |
78 | | - env: |
79 | | - release_id: ${{ needs.create-release.outputs.release_id }} |
80 | | - with: |
81 | | - script: | |
82 | | - github.rest.repos.updateRelease({ |
83 | | - owner: context.repo.owner, |
84 | | - repo: context.repo.repo, |
85 | | - release_id: process.env.release_id, |
86 | | - draft: false, |
87 | | - prerelease: false |
88 | | - }) |
| 52 | + tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. |
| 53 | + releaseName: "App v__VERSION__" |
| 54 | + releaseBody: "See the assets to download this version and install." |
| 55 | + releaseDraft: true |
| 56 | + prerelease: false |
| 57 | + args: ${{ matrix.args }} |
0 commit comments