Skip to content

Commit 92eb41d

Browse files
committed
chore(): add github action
1 parent 2b34362 commit 92eb41d

2 files changed

Lines changed: 93 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "app-v*"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Release tag to build, for example app-v0.1.0"
11+
required: true
12+
type: string
13+
14+
permissions:
15+
contents: write
16+
17+
env:
18+
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
19+
20+
jobs:
21+
release:
22+
name: Build ${{ matrix.label }}
23+
runs-on: macos-latest
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
include:
28+
- label: macOS Intel
29+
target: x86_64-apple-darwin
30+
args: --target x86_64-apple-darwin
31+
- label: macOS Apple Silicon
32+
target: aarch64-apple-darwin
33+
args: --target aarch64-apple-darwin
34+
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
with:
39+
ref: ${{ env.RELEASE_TAG }}
40+
41+
- name: Validate release tag
42+
shell: bash
43+
run: |
44+
set -euo pipefail
45+
version="$(node -p "require('./src-tauri/tauri.conf.json').version")"
46+
expected="app-v${version}"
47+
if [[ "${RELEASE_TAG}" != "${expected}" ]]; then
48+
echo "Release tag ${RELEASE_TAG} does not match src-tauri/tauri.conf.json version ${version}."
49+
echo "Expected tag: ${expected}"
50+
exit 1
51+
fi
52+
53+
- name: Setup pnpm
54+
uses: pnpm/action-setup@v4
55+
with:
56+
version: 10
57+
58+
- name: Setup Node.js
59+
uses: actions/setup-node@v4
60+
with:
61+
node-version: 24
62+
cache: pnpm
63+
64+
- name: Setup Rust
65+
uses: dtolnay/rust-toolchain@stable
66+
with:
67+
targets: ${{ matrix.target }}
68+
69+
- name: Cache Rust
70+
uses: swatinem/rust-cache@v2
71+
with:
72+
workspaces: src-tauri -> target
73+
74+
- name: Install dependencies
75+
run: pnpm install --frozen-lockfile
76+
77+
- name: Test frontend
78+
run: pnpm test
79+
80+
- name: Typecheck frontend
81+
run: pnpm typecheck
82+
83+
- name: Build and publish Tauri app
84+
uses: tauri-apps/tauri-action@v0
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
with:
88+
tagName: ${{ env.RELEASE_TAG }}
89+
releaseName: Codex Usage Desktop ${{ env.RELEASE_TAG }}
90+
releaseDraft: false
91+
prerelease: false
92+
args: ${{ matrix.args }}

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "Codex Usage Desktop",
4-
"version": "0.1.0",
4+
"version": "app-v0.1.0",
55
"identifier": "com.ccusage.codex.desktop",
66
"build": {
77
"beforeDevCommand": "pnpm dev",

0 commit comments

Comments
 (0)