Skip to content

Commit

Permalink
Establish CI/CD workflows for multi-platform builds
Browse files Browse the repository at this point in the history
- Establish GitHub Actions workflows for building and releasing the project.
- Configure the build workflow to support multiple platforms and install necessary dependencies.
- Implement a release workflow that automates the creation of draft releases on tag pushes.
  • Loading branch information
zhongweili committed Oct 31, 2024
1 parent f2a5175 commit af1b4aa
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build

on:
push:
branches:
- master
paths:
- 'src/**'
- 'src-tauri/**'
- 'pnpm-lock.yaml'
- '.github/workflows/build.yml'
workflow_dispatch:

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
test-build:
strategy:
fail-fast: true
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4

- name: Install pnpm + deps
uses: pnpm/action-setup@v2
with:
version: 9
run_install: true

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Install Linux dependencies
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: Build Vite + Tauri
run: pnpm build
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release

on:
push:
tags:
- 'v*'
workflow_dispatch:

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true

jobs:
publish:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 9
run_install: true

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- 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: Build Vite + Tauri
run: pnpm build

- name: Create release
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: 'v__VERSION__'
releaseBody: 'See the assets to download and install this version.'
releaseDraft: true
prerelease: false

0 comments on commit af1b4aa

Please sign in to comment.