Skip to content

Commit

Permalink
ci: add GitHub actions workflows (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-berger authored Feb 1, 2024
1 parent 1dbccea commit dcbc9e4
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 9 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Build

on:
workflow_call:
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
# MacOS (Intel & Apple Silicon)
- platform: macos-latest
rust-targets: x86_64-apple-darwin,aarch64-apple-darwin
tauri-target: universal-apple-darwin
# 64-bit Linux
- platform: ubuntu-22.04
rust-targets: x86_64-unknown-linux-gnu
tauri-target: x86_64-unknown-linux-gnu
# 64-bit Windows
- platform: windows-latest
rust-targets: x86_64-pc-windows-msvc
tauri-target: x86_64-pc-windows-msvc
# 32-bit Windows
- platform: windows-latest
rust-targets: i686-pc-windows-msvc
tauri-target: i686-pc-windows-msvc

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

- uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248
with:
toolchain: nightly
targets: ${{ matrix.rust-targets }}

- uses: swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894
with:
workspaces: packages/desktop
shared-key: ${{ matrix.tauri-target }}-${{ hashFiles('packages/desktop/Cargo.lock') }}

- name: Install dependencies (Ubuntu)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- run: pnpm i
- run: pnpm build --filter zebar --filter @zebar/client

- uses: tauri-apps/tauri-action@v0
id: tauri
with:
projectPath: packages/desktop
args: --target ${{ matrix.tauri-target }}

- name: Move & rename artifacts
run: |
mkdir tmp
ARTIFACTS='${{ steps.tauri.outputs.artifactPaths }}'
for ARTIFACT in $(echo "$ARTIFACTS" | jq -r '.[]'); do
mv "$ARTIFACT" "tmp/tauri.${ARTIFACT##*.}"
done
shell: bash

- uses: actions/upload-artifact@v3
with:
name: bundle-${{ matrix.tauri-target }}
if-no-files-found: error
path: tmp
21 changes: 21 additions & 0 deletions .github/workflows/lint-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Lint check

on: push

jobs:
lint-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- run: pnpm i
- run: pnpm run lint
13 changes: 13 additions & 0 deletions .github/workflows/pr-title-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: PR title check

on:
pull_request:
types: [opened, edited, synchronize, reopened]

jobs:
pr-title-check:
runs-on: ubuntu-latest
steps:
- uses: glzr-io/actions/semantic-prs@main
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
62 changes: 62 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release

on:
workflow_dispatch:

permissions:
contents: write
issues: write
pull-requests: write
id-token: write

concurrency:
group: release

jobs:
build:
uses: ./.github/workflows/build.yaml

release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/download-artifact@v4
with:
path: tmp
pattern: bundle-*

- uses: glzr-io/actions/semantic-release@main
with:
gh-publish: true
gh-token: ${{ secrets.GITHUB_TOKEN }}
gh-draft-release: false
gh-assets: |
[
{
"path": "tmp/bundle-x86_64-pc-windows-msvc/tauri.msi",
"name": "Zebar_x64_${nextRelease.gitTag}.msi"
},
{
"path": "tmp/bundle-i686-pc-windows-msvc/tauri.msi",
"name": "Zebar_x86_${nextRelease.gitTag}.msi"
},
{
"path": "tmp/bundle-universal-apple-darwin/tauri.dmg",
"name": "Zebar_${nextRelease.gitTag}.dmg"
},
{
"path": "tmp/bundle-x86_64-unknown-linux-gnu/tauri.deb",
"name": "Zebar_x64_${nextRelease.gitTag}.deb"
},
{
"path": "tmp/bundle-x86_64-unknown-linux-gnu/tauri.AppImage",
"name": "Zebar_x64_${nextRelease.gitTag}.AppImage"
}
]
npm-publish: true
npm-token: ${{ secrets.NPM_TOKEN }}
npm-package-root: packages/client-api
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev --continue",
"format": "prettier --write \"**/*.{ts,tsx,md,html,json,js,scss}\" && turbo run format"
"format": "prettier --write \"**/*.{ts,tsx,md,html,json,js,scss}\" && turbo run format",
"lint": "prettier --check \"**/*.{ts,tsx,md,html,json,js,scss}\" && turbo run lint"
},
"prettier": "@glzr/style-guide/prettier",
"dependencies": {},
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
],
"identifier": "glazer.zebar",
"resources": ["resources/*"],
"targets": "all"
"targets": ["deb", "appimage", "msi", "dmg", "updater"]
},
"macOSPrivateApi": true,
"security": {
Expand Down
10 changes: 3 additions & 7 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
},
"lint": {
"outputs": []
},
"format": {
"outputs": []
"outputs": ["dist/**"]
},
"format": {},
"lint": {},
"dev": {
"cache": false
}
Expand Down

0 comments on commit dcbc9e4

Please sign in to comment.