Skip to content

Commit b6b8ec7

Browse files
committed
chore: add publish wf
1 parent efb4997 commit b6b8ec7

File tree

1 file changed

+171
-0
lines changed

1 file changed

+171
-0
lines changed

.github/workflows/release.yml

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- publish.wf # TEMPORARY - Remove before merging to main
7+
tags:
8+
- 'v*'
9+
workflow_dispatch:
10+
inputs:
11+
tag:
12+
description: 'Release tag (e.g., v0.0.6)'
13+
required: true
14+
type: string
15+
16+
jobs:
17+
build-macos:
18+
name: Build macOS (${{ matrix.arch }})
19+
runs-on: macos-latest
20+
strategy:
21+
matrix:
22+
arch: [arm64, x64]
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Setup pnpm
29+
uses: pnpm/action-setup@v4
30+
with:
31+
version: 10.13.1
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: '20'
37+
cache: 'pnpm'
38+
39+
- name: Install dependencies
40+
run: pnpm install --frozen-lockfile
41+
42+
- name: Download Node.js binaries
43+
working-directory: apps/desktop
44+
run: pnpm download-node:all
45+
46+
- name: Build Swift helper
47+
run: pnpm build:swift-helper
48+
49+
- name: Import Apple certificates
50+
env:
51+
APPLE_CERT_BASE64: ${{ secrets.APPLE_CERT_BASE64 }}
52+
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
53+
run: |
54+
# Create temporary keychain
55+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
56+
KEYCHAIN_PASSWORD=actions
57+
58+
# Decode certificate
59+
echo "$APPLE_CERT_BASE64" | base64 --decode > certificate.p12
60+
61+
# Create keychain
62+
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
63+
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
64+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
65+
66+
# Import certificate
67+
security import certificate.p12 -P "$APPLE_CERT_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
68+
security list-keychain -d user -s "$KEYCHAIN_PATH"
69+
70+
# Set key partition list
71+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
72+
73+
# Clean up
74+
rm certificate.p12
75+
76+
- name: Build artifacts
77+
working-directory: apps/desktop
78+
env:
79+
APPLE_ID: ${{ secrets.APPLE_ID }}
80+
APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
81+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
82+
CODESIGNING_IDENTITY: ${{ secrets.CODESIGNING_IDENTITY }}
83+
run: |
84+
# Build both DMG and ZIP with single make command
85+
pnpm make:${{ matrix.arch }}
86+
87+
- name: Get version from package.json
88+
id: package_version
89+
working-directory: apps/desktop
90+
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
91+
92+
- name: Upload artifacts
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: macos-${{ matrix.arch }}
96+
path: |
97+
apps/desktop/out/make/*.dmg
98+
apps/desktop/out/make/zip/darwin/${{ matrix.arch }}/*.zip
99+
100+
release:
101+
name: Create Release
102+
needs: build-macos
103+
runs-on: ubuntu-latest
104+
permissions:
105+
contents: write
106+
107+
steps:
108+
- name: Checkout code
109+
uses: actions/checkout@v4
110+
111+
- name: Setup pnpm
112+
uses: pnpm/action-setup@v4
113+
with:
114+
version: 10.13.1
115+
116+
- name: Setup Node.js
117+
uses: actions/setup-node@v4
118+
with:
119+
node-version: '20'
120+
cache: 'pnpm'
121+
122+
- name: Get version from package.json
123+
id: package_version
124+
working-directory: apps/desktop
125+
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
126+
127+
- name: Download all artifacts
128+
uses: actions/download-artifact@v4
129+
with:
130+
path: artifacts
131+
132+
- name: List artifacts
133+
run: ls -la artifacts/*
134+
135+
- name: Create Release
136+
uses: softprops/action-gh-release@v2
137+
with:
138+
draft: true
139+
prerelease: true
140+
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
141+
name: Amical Desktop v${{ steps.package_version.outputs.version }}
142+
body: |
143+
## Amical Desktop v${{ steps.package_version.outputs.version }}
144+
145+
### What's New
146+
- Please update this section with actual changes
147+
148+
### Downloads
149+
150+
#### macOS
151+
- **Apple Silicon (M1/M2/M3)**:
152+
- DMG: `Amical-${{ steps.package_version.outputs.version }}-arm64.dmg`
153+
- ZIP: `Amical-darwin-arm64-${{ steps.package_version.outputs.version }}.zip`
154+
- **Intel**:
155+
- DMG: `Amical-${{ steps.package_version.outputs.version }}-x64.dmg`
156+
- ZIP: `Amical-darwin-x64-${{ steps.package_version.outputs.version }}.zip`
157+
158+
### Installation
159+
160+
**macOS**:
161+
- **DMG**: Download and open the DMG file, then drag Amical to your Applications folder
162+
- **ZIP**: Download and extract the ZIP file, then drag Amical to your Applications folder
163+
164+
The ZIP files are primarily for automatic updates. We recommend using the DMG files for initial installation.
165+
files: |
166+
artifacts/macos-arm64/*.dmg
167+
artifacts/macos-arm64/*.zip
168+
artifacts/macos-x64/*.dmg
169+
artifacts/macos-x64/*.zip
170+
env:
171+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)