Skip to content

publish

publish #235

name: 'publish'
on: [workflow_dispatch]
jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest,macos-latest,windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 18
- id: set_var_win
if: matrix.platform == 'windows-latest'
run: |
choco install jq -y
- id: set_var
shell: bash
run: |
echo "VERSION_JSON=$(jq -c . < version.json)" >> $GITHUB_ENV
- name: install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: install frontend dependencies
run: pnpm install --no-frozen-lockfile # change this to npm or pnpm depending on which one you use
- if: matrix.platform == 'ubuntu-latest'
run: pnpm tauri build --target x86_64-unknown-linux-gnu
- if: matrix.platform == 'ubuntu-latest'
uses: "softprops/action-gh-release@v1"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
tag_name: "v${{fromJson(env.VERSION_JSON).version}}"
name: "${{fromJson(env.VERSION_JSON).version}}"
generate_release_notes: true
files: |
src-tauri/target/x86_64-unknown-linux-gnu/release/**/*.deb
src-tauri/target/x86_64-unknown-linux-gnu/release/**/*.AppImage
- if: matrix.platform == 'macos-latest'
run: pnpm tauri build --target x86_64-apple-darwin
- if: matrix.platform == 'macos-latest'
run: rustup target add aarch64-apple-darwin
- if: matrix.platform == 'macos-latest'
run: pnpm tauri build --target aarch64-apple-darwin
- if: matrix.platform == 'macos-latest'
uses: "softprops/action-gh-release@v1"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
tag_name: "v${{fromJson(env.VERSION_JSON).version}}"
name: "${{fromJson(env.VERSION_JSON).version}}"
generate_release_notes: true
files: |
src-tauri/target/*/release/bundle/macos/*.app
src-tauri/target/*/release/bundle/dmg/*.dmg
- if: matrix.platform == 'windows-latest'
run: pnpm tauri build
- if: matrix.platform == 'windows-latest'
uses: "softprops/action-gh-release@v1"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
tag_name: "v${{fromJson(env.VERSION_JSON).version}}"
name: "${{fromJson(env.VERSION_JSON).version}}"
generate_release_notes: true
files: |
src-tauri/target/x86_64-pc-windows-msvc/release/**/*.msi
# publish dist as zip when building on ubuntu
# first, zip the dist
- if: matrix.platform == 'ubuntu-latest'
run: zip -r built_code.zip dist
# then, publish the zip file
- if: matrix.platform == 'ubuntu-latest'
uses: "softprops/action-gh-release@v1"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
tag_name: "v${{fromJson(env.VERSION_JSON).version}}"
name: "${{fromJson(env.VERSION_JSON).version}}"
generate_release_notes: true
files: built_code.zip