Skip to content

Commit

Permalink
chore: improve bundle workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriansaliou committed Mar 23, 2024
1 parent 13ddc55 commit e338f18
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ name: Bundle and Publish
jobs:
bundle:
environment: bundle-build
runs-on: ${{ matrix.settings.platform }}
runs-on: ${{ matrix.settings.runner }}

strategy:
fail-fast: false
matrix:
settings:
- platform: macos-latest
- runner: macos-latest
system: mac
architecture: aarch64
target: aarch64-apple-darwin
toolchain: aarch64-apple-darwin
bundles: app,dmg,updater
os: mac

outputs:
tag: ${{ steps.current_tag.outputs.tag }}
Expand All @@ -35,9 +34,11 @@ jobs:
registry-url: https://registry.npmjs.org

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
uses: actions-rs/toolchain@v1
with:
target: "${{ matrix.settings.toolchain }}"
toolchain: stable
target: ${{ matrix.settings.target }}
override: true

- name: Verify versions
run: node --version && npm --version && node -p process.versions.v8 && rustc --version
Expand All @@ -51,11 +52,16 @@ jobs:
node_modules
key: ${{ runner.os }}-node

- name: Cache build context (Rust)
uses: swatinem/rust-cache@v2
- name: Cache build context (Cargo)
id: cache-cargo
uses: actions/cache@v3
with:
workspaces: "./src-tauri -> target"
shared-key: ${{ runner.os }}-${{ matrix.settings.toolchain }}-rust
path: |
~/.cargo/bin
~/.cargo/registry
~/.cargo/git
src-tauri/target
key: ${{ runner.os }}-${{ matrix.settings.target }}-cargo

- name: Get current tag
id: current_tag
Expand All @@ -82,13 +88,13 @@ jobs:
args: --target ${{ matrix.settings.target }} --bundles ${{ matrix.settings.bundles }}

- name: Archive output files
run: tar -zcvf ./bundle-${{ steps.current_tag.outputs.tag }}-${{ matrix.settings.os }}.tar.gz -C src-tauri/target/${{ matrix.settings.target }}/release/bundle/ .
run: tar -zcvf ./bundle-${{ steps.current_tag.outputs.tag }}-${{ matrix.settings.system }}.tar.gz -C src-tauri/target/${{ matrix.settings.target }}/release/bundle/ .

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.current_tag.outputs.tag }} Bundle (${{ runner.os }} ${{ matrix.settings.architecture }})
path: ./bundle-${{ steps.current_tag.outputs.tag }}-${{ matrix.settings.os }}.tar.gz
path: ./bundle-${{ steps.current_tag.outputs.tag }}-${{ matrix.settings.system }}.tar.gz
retention-days: 7

publish:
Expand All @@ -100,10 +106,10 @@ jobs:
fail-fast: false
matrix:
settings:
- platform: macos
- name: macOS
platform: macos
system: mac
architecture: aarch64
name: macOS
os: mac
format: dmg

steps:
Expand All @@ -113,7 +119,7 @@ jobs:
name: ${{ needs.bundle.outputs.tag }} Bundle (${{ matrix.settings.name }} ${{ matrix.settings.architecture }})

- name: Extract build artifacts
run: tar -xzvf ./bundle-${{ needs.bundle.outputs.tag }}-${{ matrix.settings.os }}.tar.gz
run: tar -xzvf ./bundle-${{ needs.bundle.outputs.tag }}-${{ matrix.settings.system }}.tar.gz

- name: Publish application
env:
Expand Down

0 comments on commit e338f18

Please sign in to comment.