Skip to content

Commit 9b73835

Browse files
committed
feat: add build and release workflows for macOS with version handling
1 parent d9dd43b commit 9b73835

2 files changed

Lines changed: 109 additions & 107 deletions

File tree

.github/workflows/build.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Build Application
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
version:
7+
required: false
8+
type: string
9+
description: "The version to build"
10+
should_build:
11+
required: false
12+
type: boolean
13+
default: true
14+
description: "Whether to build the application"
15+
outputs:
16+
macos_aarch64_artifact:
17+
description: "Name of the macOS ARM64 build artifact"
18+
value: circle-camera-macos-aarch64
19+
macos_x64_artifact:
20+
description: "Name of the macOS x64 build artifact"
21+
value: circle-camera-macos-x64
22+
workflow_dispatch:
23+
inputs:
24+
version:
25+
required: false
26+
type: string
27+
description: "Version override (uses package.json if not provided)"
28+
29+
jobs:
30+
build-macos:
31+
runs-on: macos-latest
32+
if: inputs.should_build != false
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v4
36+
37+
- name: Setup Node.js
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: '18'
41+
cache: 'pnpm'
42+
43+
- name: Install Rust stable
44+
uses: dtolnay/rust-toolchain@stable
45+
with:
46+
components: rustfmt, clippy
47+
targets: aarch64-apple-darwin,x86_64-apple-darwin
48+
49+
- name: Install additional dependencies
50+
run: |
51+
rustup target add aarch64-apple-darwin x86_64-apple-darwin
52+
rustup default stable
53+
rustup show
54+
cargo --version
55+
56+
- name: Install PNPM
57+
uses: pnpm/action-setup@v3
58+
with:
59+
version: 8
60+
61+
- name: Install dependencies
62+
run: pnpm install
63+
64+
- name: Get version from package.json if not provided
65+
if: inputs.version == ''
66+
id: get_version
67+
run: |
68+
VERSION=$(node -p "require('./package.json').version")
69+
echo "VERSION=$VERSION" >> $GITHUB_ENV
70+
echo "Using version from package.json: $VERSION"
71+
72+
- name: Set provided version
73+
if: inputs.version != ''
74+
run: |
75+
echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV
76+
echo "Using provided version: ${{ inputs.version }}"
77+
78+
- name: Build for macOS (Apple Silicon)
79+
run: pnpm tauri build --target aarch64-apple-darwin
80+
81+
- name: Build for macOS (Intel)
82+
run: pnpm tauri build --target x86_64-apple-darwin
83+
84+
- name: Upload macOS (Apple Silicon) Artifact
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: circle-camera-macos-aarch64
88+
path: src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/*.dmg
89+
90+
- name: Upload macOS (Intel) Artifact
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: circle-camera-macos-x64
94+
path: src-tauri/target/x86_64-apple-darwin/release/bundle/dmg/*.dmg

.github/workflows/release.yml

Lines changed: 15 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
paths:
88
- 'package.json'
99
- 'src-tauri/tauri.conf.json'
10+
workflow_dispatch:
11+
inputs:
12+
force_release:
13+
description: 'Force a release even if version has not changed'
14+
type: boolean
15+
default: false
1016

1117
jobs:
1218
check-version:
@@ -38,8 +44,8 @@ jobs:
3844
echo "Previous version: $PREVIOUS_VERSION"
3945
4046
# Determine if we should create a release
41-
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
42-
echo "Version changed from $PREVIOUS_VERSION to $CURRENT_VERSION"
47+
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ] || ${{ github.event.inputs.force_release == 'true' }}; then
48+
echo "Version changed from $PREVIOUS_VERSION to $CURRENT_VERSION or force_release is true"
4349
echo "should_release=true" >> $GITHUB_OUTPUT
4450
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
4551
echo "previous_version=$PREVIOUS_VERSION" >> $GITHUB_OUTPUT
@@ -48,113 +54,17 @@ jobs:
4854
echo "should_release=false" >> $GITHUB_OUTPUT
4955
fi
5056
51-
build-macos:
57+
build:
5258
needs: check-version
5359
if: needs.check-version.outputs.should_release == 'true'
54-
runs-on: macos-latest
55-
steps:
56-
- name: Checkout repository
57-
uses: actions/checkout@v4
58-
59-
- name: Setup Node.js
60-
uses: actions/setup-node@v4
61-
with:
62-
node-version: '18'
63-
cache: 'pnpm'
64-
65-
- name: Install Rust stable
66-
uses: dtolnay/rust-toolchain@stable
67-
with:
68-
components: rustfmt, clippy
69-
targets: aarch64-apple-darwin,x86_64-apple-darwin
70-
71-
- name: Install additional dependencies
72-
run: |
73-
rustup target add aarch64-apple-darwin x86_64-apple-darwin
74-
rustup default stable
75-
rustup show
76-
cargo --version
77-
78-
- name: Install PNPM
79-
uses: pnpm/action-setup@v3
80-
with:
81-
version: 8
82-
83-
- name: Install dependencies
84-
run: pnpm install
85-
86-
- name: Build for macOS (Apple Silicon)
87-
run: pnpm tauri build --target aarch64-apple-darwin
88-
89-
- name: Build for macOS (Intel)
90-
run: pnpm tauri build --target x86_64-apple-darwin
91-
92-
- name: Upload macOS (Apple Silicon) Artifact
93-
uses: actions/upload-artifact@v4
94-
with:
95-
name: circle-camera-macos-aarch64
96-
path: src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/*.dmg
97-
98-
- name: Upload macOS (Intel) Artifact
99-
uses: actions/upload-artifact@v4
100-
with:
101-
name: circle-camera-macos-x64
102-
path: src-tauri/target/x86_64-apple-darwin/release/bundle/dmg/*.dmg
103-
104-
# Windows build is commented out as Windows is not officially supported
105-
# build-windows:
106-
# needs: check-version
107-
# if: needs.check-version.outputs.should_release == 'true'
108-
# runs-on: windows-latest
109-
# steps:
110-
# - name: Checkout repository
111-
# uses: actions/checkout@v4
112-
#
113-
# - name: Setup Node.js
114-
# uses: actions/setup-node@v4
115-
# with:
116-
# node-version: '18'
117-
# cache: 'pnpm'
118-
#
119-
# - name: Install Rust stable
120-
# uses: dtolnay/rust-toolchain@stable
121-
# with:
122-
# components: rustfmt, clippy
123-
# targets: x86_64-pc-windows-msvc
124-
#
125-
# - name: Install additional dependencies
126-
# run: |
127-
# rustup target add x86_64-pc-windows-msvc
128-
# rustup default stable
129-
# rustup show
130-
# cargo --version
131-
#
132-
# - name: Install PNPM
133-
# uses: pnpm/action-setup@v3
134-
# with:
135-
# version: 8
136-
#
137-
# - name: Install dependencies
138-
# run: pnpm install
139-
#
140-
# - name: Install Windows WebView2
141-
# run: |
142-
# $ProgressPreference = 'SilentlyContinue'
143-
# Invoke-WebRequest "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile "MicrosoftEdgeWebview2Setup.exe"
144-
# Start-Process -FilePath "MicrosoftEdgeWebview2Setup.exe" -Args "/silent /install" -Verb RunAs -Wait
145-
#
146-
# - name: Build for Windows
147-
# run: pnpm tauri build --target x86_64-pc-windows-msvc
148-
#
149-
# - name: Upload Windows Artifact
150-
# uses: actions/upload-artifact@v4
151-
# with:
152-
# name: circle-camera-windows
153-
# path: src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/*.msi
60+
uses: ./.github/workflows/build.yml
61+
with:
62+
version: ${{ needs.check-version.outputs.version }}
63+
should_build: true
15464

15565
create-release:
156-
needs: [check-version, build-macos]
157-
# Remove build-windows from dependencies since Windows is not supported
66+
needs: [check-version, build]
67+
if: needs.check-version.outputs.should_release == 'true'
15868
runs-on: ubuntu-latest
15969
steps:
16070
- name: Checkout repository
@@ -244,8 +154,6 @@ jobs:
244154
asset_name: Circle.Camera_${{ needs.check-version.outputs.version }}_x64.dmg
245155
asset_content_type: application/octet-stream
246156

247-
# Windows asset upload is removed as it's not supported
248-
249157
- name: Upload latest.json Asset
250158
uses: actions/upload-release-asset@v1
251159
env:

0 commit comments

Comments
 (0)