|
6 | 6 | - main
|
7 | 7 | workflow_dispatch:
|
8 | 8 | inputs:
|
9 |
| - force_upload_or_reupload_assets: |
10 |
| - description: "Force upload/re-upload assets." |
| 9 | + force_release_build_assets: |
| 10 | + description: "Force run release_build_assets" |
| 11 | + type: boolean |
| 12 | + default: false |
| 13 | + required: false |
| 14 | + force_build_and_publish_snap: |
| 15 | + description: "Force run build_and_publish_snap" |
11 | 16 | type: boolean
|
12 | 17 | default: false
|
13 | 18 | required: false
|
|
28 | 33 | runs-on: ubuntu-latest
|
29 | 34 | outputs:
|
30 | 35 | is_published: ${{ steps.changesets.outputs.published }}
|
| 36 | + version: ${{ steps.new_version.outputs.value }} |
31 | 37 | steps:
|
32 | 38 | - name: "Checkout repository"
|
33 | 39 | uses: actions/checkout@v4
|
@@ -90,10 +96,10 @@ jobs:
|
90 | 96 | env:
|
91 | 97 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
92 | 98 |
|
93 |
| - release_builds: |
94 |
| - name: "Release Builds" |
| 99 | + release_build_assets: |
| 100 | + name: "Release Build Assets" |
95 | 101 | needs: [version_or_publish]
|
96 |
| - if: ${{ github.repository == 'buildzaku/zaku' && (needs.version_or_publish.outputs.is_published == 'true' || github.event.inputs.force_upload_or_reupload_assets == 'true') }} |
| 102 | + if: ${{ github.repository == 'buildzaku/zaku' && (needs.version_or_publish.outputs.is_published == 'true' || github.event.inputs.force_release_build_assets == 'true') }} |
97 | 103 | permissions:
|
98 | 104 | contents: "write"
|
99 | 105 | strategy:
|
@@ -159,11 +165,96 @@ jobs:
|
159 | 165 | - name: "Install frontend dependencies"
|
160 | 166 | run: pnpm install
|
161 | 167 |
|
162 |
| - - name: "Create release builds" |
| 168 | + - name: "Build and upload artifacts" |
163 | 169 | uses: tauri-apps/tauri-action@v0
|
164 | 170 | env:
|
165 | 171 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
166 | 172 | with:
|
167 | 173 | tagName: "v__VERSION__"
|
168 | 174 | releaseName: "v__VERSION__"
|
169 | 175 | args: ${{ matrix.args }}
|
| 176 | + |
| 177 | + build_and_publish_snap: |
| 178 | + name: "Build & Publish Snap" |
| 179 | + needs: [version_or_publish] |
| 180 | + if: ${{ github.repository == 'buildzaku/zaku' && (needs.version_or_publish.outputs.is_published == 'true' || github.event.inputs.force_build_and_publish_snap == 'true') }} |
| 181 | + runs-on: ubuntu-latest |
| 182 | + steps: |
| 183 | + - name: "Checkout repository" |
| 184 | + uses: actions/checkout@v4 |
| 185 | + |
| 186 | + - name: "Setup pnpm" |
| 187 | + uses: pnpm/action-setup@v4 |
| 188 | + with: |
| 189 | + version: ${{ env.PNPM_VERSION }} |
| 190 | + |
| 191 | + - name: "Setup Node.js" |
| 192 | + uses: actions/setup-node@v4 |
| 193 | + with: |
| 194 | + node-version: ${{ env.NODE_VERSION }} |
| 195 | + cache: pnpm |
| 196 | + |
| 197 | + - name: "Get pnpm store directory" |
| 198 | + id: pnpm_cache |
| 199 | + shell: bash |
| 200 | + run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT |
| 201 | + |
| 202 | + - name: "Setup pnpm cache" |
| 203 | + uses: actions/cache@v4 |
| 204 | + with: |
| 205 | + path: ${{ steps.pnpm_cache.outputs.pnpm_cache_dir }} |
| 206 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 207 | + restore-keys: ${{ runner.os }}-pnpm-store- |
| 208 | + |
| 209 | + - name: "Setup Rust" |
| 210 | + uses: dtolnay/rust-toolchain@stable |
| 211 | + |
| 212 | + - name: "Setup Rust cache" |
| 213 | + uses: swatinem/rust-cache@v2 |
| 214 | + with: |
| 215 | + workspaces: "./src-tauri -> target" |
| 216 | + |
| 217 | + - name: "Install system dependencies" |
| 218 | + run: | |
| 219 | + sudo apt-get update |
| 220 | + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libasound2-dev |
| 221 | +
|
| 222 | + - name: "Install frontend dependencies" |
| 223 | + run: pnpm install |
| 224 | + |
| 225 | + - name: "Build application" |
| 226 | + run: pnpm tauri build --bundles deb |
| 227 | + |
| 228 | + - name: "Extract .deb to snap-stage/" |
| 229 | + run: | |
| 230 | + mkdir -p snap-stage |
| 231 | + dpkg -x src-tauri/target/release/bundle/deb/*.deb snap-stage/ |
| 232 | + sed -i -e "s|Icon=zaku|Icon=/usr/share/icons/hicolor/32x32/apps/zaku.png|g" snap-stage/usr/share/applications/Zaku.desktop |
| 233 | +
|
| 234 | + - name: "Set Snap release channel" |
| 235 | + id: snap_channel |
| 236 | + shell: bash |
| 237 | + run: | |
| 238 | + VERSION="${{ needs.version_or_publish.outputs.version }}" |
| 239 | +
|
| 240 | + if [[ "$VERSION" == *"-alpha."* ]]; then |
| 241 | + echo "channel=edge" >> $GITHUB_OUTPUT |
| 242 | + elif [[ "$VERSION" == *"-beta."* ]]; then |
| 243 | + echo "channel=beta" >> $GITHUB_OUTPUT |
| 244 | + elif [[ "$VERSION" == *"-rc."* ]]; then |
| 245 | + echo "channel=candidate" >> $GITHUB_OUTPUT |
| 246 | + else |
| 247 | + echo "channel=stable" >> $GITHUB_OUTPUT |
| 248 | + fi |
| 249 | +
|
| 250 | + - name: "Build Snap package" |
| 251 | + uses: snapcore/action-build@v1 |
| 252 | + id: build |
| 253 | + |
| 254 | + - name: "Publish to Snap Store" |
| 255 | + uses: snapcore/action-publish@v1 |
| 256 | + env: |
| 257 | + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} |
| 258 | + with: |
| 259 | + snap: ${{ steps.build.outputs.snap }} |
| 260 | + release: ${{ steps.snap_channel.outputs.channel }} |
0 commit comments