Skip to content

Commit

Permalink
Refactor GitHub Actions workflows for build and release
Browse files Browse the repository at this point in the history
- Deleted `actions.yml` to separate build and release workflows for better clarity and maintainability.
- Introduced `build-common.yml` to define common setup steps for node, Rust, and dependencies across platforms.
- Added `build.yml` for handling build processes across different platforms with matrix strategy.
- Created `release.yml` specifically for release tasks, ensuring builds are conducted and releases are drafted on designated branches.
- These changes enhance modularity and reusability of the workflow configurations.
  • Loading branch information
takanotume24 committed Nov 8, 2024
1 parent 5b47337 commit c702af5
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 88 deletions.
88 changes: 0 additions & 88 deletions .github/workflows/actions.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/build-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Common Build Steps

on:
workflow_call:
inputs:
platform:
required: true
type: string
args:
required: true
type: string

jobs:
common-steps:
runs-on: ${{ inputs.platform }}

steps:
- uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ inputs.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}

- name: install dependencies (ubuntu only)
if: inputs.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: install frontend dependencies
run: npm install
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build

on:
push:
branches-ignore:
- 'release'

jobs:
build:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest'
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest'
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04'
args: ''
- platform: 'windows-latest'
args: ''

steps:
- name: Call Common Build Steps
uses: ./.github/workflows/build-common.yml
with:
platform: ${{ matrix.platform }}
args: ${{ matrix.args }}

- name: Build Tauri App
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: ${{ matrix.args }}
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release

on:
push:
branches:
- 'release'

jobs:
release:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest'
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest'
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04'
args: ''
- platform: 'windows-latest'
args: ''

steps:
- name: Call Common Build Steps
uses: ./.github/workflows/build-common.yml
with:
platform: ${{ matrix.platform }}
args: ${{ matrix.args }}

- name: Create GitHub Release
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: app-v__VERSION__
releaseName: 'App v__VERSION__'
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: false
args: ''

0 comments on commit c702af5

Please sign in to comment.