|
1 | 1 | # https://docs.crabnebula.dev/cloud/ci/tauri-v2-workflow/ |
2 | 2 | on: |
3 | 3 | workflow_dispatch: |
4 | | - inputs: |
5 | | - channel: |
6 | | - description: "Release channel to use. Defaults to 'stable' for manual runs, 'nightly' for automated releases" |
7 | | - required: false |
8 | | - default: "stable" |
9 | | - type: choice |
10 | | - options: |
11 | | - - "stable" |
12 | | - - "nightly" |
13 | | - runner: |
14 | | - description: "Type of runner to use." |
15 | | - required: false |
16 | | - default: "github" |
17 | | - type: choice |
18 | | - options: |
19 | | - - "warp" |
20 | | - - "github" |
21 | 4 | release: |
22 | 5 | types: |
23 | 6 | - published |
24 | | - - prereleased |
| 7 | + |
25 | 8 | concurrency: |
26 | 9 | group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} |
27 | 10 | cancel-in-progress: true |
28 | 11 | env: |
29 | 12 | CN_APPLICATION: "fastrepl/hyprnote" |
30 | | - RELEASE_CHANNEL: ${{ github.event_name == 'workflow_dispatch' && inputs.channel || 'nightly' }} |
31 | | - TAURI_CONF_PATH: ${{ (github.event_name == 'workflow_dispatch' && inputs.channel == 'stable') && './src-tauri/tauri.conf.stable.json' || './src-tauri/tauri.conf.nightly.json' }} |
| 13 | + RELEASE_CHANNEL: ${{ (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')) && 'nightly' || (github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/')) && 'stable' || 'staging' }} |
| 14 | + TAURI_CONF_PATH: ${{ (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')) && './src-tauri/tauri.conf.nightly.json' || (github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/')) && './src-tauri/tauri.conf.stable.json' || './src-tauri/tauri.conf.staging.json' }} |
| 15 | + |
32 | 16 | jobs: |
33 | | - draft: |
34 | | - if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'desktop_') }} |
35 | | - runs-on: ubuntu-24.04 |
36 | | - steps: |
37 | | - - uses: actions/checkout@v4 |
38 | | - - uses: ./.github/actions/cn_release |
39 | | - with: |
40 | | - cmd: draft |
41 | | - app: ${{ env.CN_APPLICATION }} |
42 | | - key: ${{ secrets.CN_API_KEY }} |
43 | | - channel: ${{ env.RELEASE_CHANNEL }} |
44 | | - framework: tauri |
45 | | - working-directory: ./apps/desktop |
46 | 17 | build: |
47 | | - if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'desktop_') }} |
48 | | - needs: draft |
| 18 | + if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && startsWith(github.event.release.tag_name, 'desktop_')) }} |
49 | 19 | permissions: |
50 | 20 | contents: write |
51 | 21 | strategy: |
|
60 | 30 | runner: "macos-latest" |
61 | 31 | # - platform: "windows" |
62 | 32 | # target: "x86_64-pc-windows-msvc" |
63 | | - # runner: "${{ inputs.runner == 'warp' && 'warp-windows-latest-x64-4x' || 'windows-latest' }}" |
| 33 | + # runner: "windows-latest" |
64 | 34 | runs-on: ${{ matrix.runner }} |
65 | 35 | defaults: |
66 | 36 | run: |
|
78 | 48 | fi |
79 | 49 | fi |
80 | 50 | shell: bash |
| 51 | + - if: ${{ env.RELEASE_CHANNEL != 'staging' }} |
| 52 | + uses: ./.github/actions/cn_release |
| 53 | + with: |
| 54 | + cmd: draft |
| 55 | + app: ${{ env.CN_APPLICATION }} |
| 56 | + key: ${{ secrets.CN_API_KEY }} |
| 57 | + channel: ${{ env.RELEASE_CHANNEL }} |
| 58 | + framework: tauri |
| 59 | + working-directory: ./apps/desktop |
81 | 60 | - uses: ./.github/actions/setup_protoc |
82 | 61 | with: |
83 | 62 | repo-token: ${{ secrets.GITHUB_TOKEN }} |
|
116 | 95 | chmod +x ./apps/desktop/src-tauri/binaries/passthrough-${{ matrix.target }} |
117 | 96 | codesign --force --options runtime -s "${{ steps.apple-cert.outputs.cert-id }}" ./apps/desktop/src-tauri/binaries/stt-${{ matrix.target }} |
118 | 97 | codesign -dv ./apps/desktop/src-tauri/binaries/stt-${{ matrix.target }} |
119 | | - ./scripts/sidecar.sh "./apps/desktop/src-tauri/tauri.conf.${{ env.RELEASE_CHANNEL }}.json" "binaries/stt" |
| 98 | + ./scripts/sidecar.sh "./apps/desktop/${{ env.TAURI_CONF_PATH }}" "binaries/stt" |
120 | 99 | - run: pnpm -F desktop tauri build --target ${{ matrix.target }} --config ${{ env.TAURI_CONF_PATH }} --verbose |
121 | 100 | env: |
122 | 101 | # https://github.com/tauri-apps/tauri-action/issues/740 |
@@ -145,16 +124,23 @@ jobs: |
145 | 124 | fi |
146 | 125 | shell: bash |
147 | 126 | working-directory: ./apps/desktop/src-tauri |
148 | | - - uses: ./.github/actions/cn_release |
| 127 | + - if: ${{ env.RELEASE_CHANNEL != 'staging' }} |
| 128 | + uses: ./.github/actions/cn_release |
149 | 129 | with: |
150 | 130 | cmd: upload |
151 | 131 | app: ${{ env.CN_APPLICATION }} |
152 | 132 | key: ${{ secrets.CN_API_KEY }} |
153 | 133 | channel: ${{ env.RELEASE_CHANNEL }} |
154 | 134 | framework: tauri |
155 | 135 | working-directory: ./apps/desktop |
| 136 | + - if: ${{ env.RELEASE_CHANNEL == 'staging' }} |
| 137 | + uses: actions/upload-artifact@v4 |
| 138 | + with: |
| 139 | + name: hyprnote-staging-${{ matrix.target }} |
| 140 | + path: apps/desktop/src-tauri/target/${{ matrix.target }}/release/bundle/dmg/*.dmg |
| 141 | + retention-days: 3 |
156 | 142 | publish: |
157 | | - if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'desktop_') }} |
| 143 | + if: ${{ ((github.event_name == 'workflow_dispatch') || (github.event_name == 'release' && startsWith(github.event.release.tag_name, 'desktop_'))) && ((github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/'))) && env.RELEASE_CHANNEL != 'staging' }} |
158 | 144 | needs: build |
159 | 145 | runs-on: ubuntu-24.04 |
160 | 146 | steps: |
|
0 commit comments