-
Notifications
You must be signed in to change notification settings - Fork 85
191 lines (166 loc) · 6.51 KB
/
draft-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Draft Release
on:
workflow_dispatch:
inputs:
prerelease:
required: true
type: boolean
description: "Is this a pre-release? If not, this will be considered the latest release"
default: true
version:
required: false
type: string
description: "Optionally input a custom version. If not, the version string will automatically be generated based on the version in package.json"
env:
UPDATE_URL_STABLE: "https://surrealist.app/latest.json"
UPDATE_URL_BETA: "https://beta.surrealist.app/latest.json"
CLOUD_CALLBACK_URL_STABLE: "https://surrealist.app/cloud/callback"
CLOUD_CALLBACK_URL_BETA: "https://beta.surrealist.app/cloud/callback"
CLOUD_CLIENT_ID: OuFa4OeeKveeRq1G6xIPgrl6EBUJtxLR
SCOUT_COPILOT_ID: copilot_cm3gcpzxw00020cs66takkem5
SCOUT_WORKFLOW_ID: wf_cm3gbr8vk00010ds6b1g0vnvv
jobs:
version:
name: Extract version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract_version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
version: 9
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Set inputted version
if: ${{ inputs.version }}
run: |
pnpm pkg set version=${{ inputs.version }}
- name: Validate unique version
run: |
v=$(pnpm pkg get version)
v=${v:1:-1}
TAG="surrealist-v$v"
if git show-ref --tags --verify --quiet "refs/tags/${TAG}"; then
echo "ERR: Tag ${TAG} already exists! Please bump the version."
exit 1
else
echo "OK: All clear! No such tag as ${TAG} found."
fi
- name: Extract version
id: extract_version
uses: Saionaro/extract-package-version@v1.3.0
draft:
name: Draft release
needs:
- version
permissions:
contents: write
strategy:
fail-fast: true
matrix:
settings:
- platform: "macos-latest"
id: "macos-aarch64"
args: "--target aarch64-apple-darwin --verbose"
- platform: "macos-latest"
id: "macos-x86_64"
args: "--target x86_64-apple-darwin --verbose"
- platform: "ubuntu-22.04"
id: "linux"
args: "--verbose"
- platform: "windows-latest"
id: "windows"
args: "--verbose"
runs-on: ${{ matrix.settings.platform }}
steps:
- name: Information
run: echo "Building Surrealist Desktop v${{ needs.version.outputs.version }} for ${{ matrix.settings.id }}"
- name: Code checkout
uses: actions/checkout@v4
- name: Install dependencies (ubuntu only)
if: matrix.settings.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
version: 9
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.settings.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: "./src-tauri -> target"
- name: Setup jq
uses: dcarbone/install-jq-action@v2
- name: Install frontend dependencies
run: pnpm i --frozen-lockfile
- name: Generate license report
run: pnpm license-report
- name: Set version
run: pnpm pkg set version=${{ needs.version.outputs.version }}
- name: Persist Apple API Key
if: matrix.settings.platform == 'macos-latest'
env:
APPLE_API_KEY_CONTENT: ${{ secrets.APPLE_API_KEY_CONTENT }}
shell: bash
run: echo "$APPLE_API_KEY_CONTENT" >> ${{ github.workspace }}/apple-api-key.p8
- name: Configure variables
shell: bash
run: |
if [ "${{ inputs.prerelease }}" == "true" ]; then
echo "UPDATE_URL=${{ env.UPDATE_URL_BETA }}" >> $GITHUB_ENV
echo "CLOUD_CALLBACK_URL=${{ env.CLOUD_CALLBACK_URL_BETA }}" >> $GITHUB_ENV
else
echo "UPDATE_URL=${{ env.UPDATE_URL_STABLE }}" >> $GITHUB_ENV
echo "CLOUD_CALLBACK_URL=${{ env.CLOUD_CALLBACK_URL_STABLE }}" >> $GITHUB_ENV
fi
- name: Debug environment
run: |
echo "Update URL: ${{ env.UPDATE_URL }}"
echo "Callback URL: ${{ env.CLOUD_CALLBACK_URL }}"
- name: Configure update endpoint
shell: bash
run: |
jq '.plugins.updater.endpoints[0] = "${{ env.UPDATE_URL }}"' ./src-tauri/tauri.conf.json > ./src-tauri/tauri.conf.temp
mv -f ./src-tauri/tauri.conf.temp ./src-tauri/tauri.conf.json
- name: Build and draft release
uses: tauri-apps/tauri-action@v0
id: build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
VITE_SURREALIST_PREVIEW: "${{ inputs.prerelease }}"
VITE_CLOUD_CLIENT_ID: ${{ env.CLOUD_CLIENT_ID }}
VITE_CLOUD_CALLBACK_URL: "${{ env.CLOUD_CALLBACK_URL }}"
VITE_SCOUT_COPILOT_ID: ${{ env.SCOUT_COPILOT_ID }}
VITE_SCOUT_WORKFLOW_ID: ${{ env.SCOUT_WORKFLOW_ID }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_PATH: ${{ github.workspace }}/apple-api-key.p8
CI: false
with:
appVersion: surrealist-v${{ needs.version.outputs.version }}
releaseId: surrealist-v${{ needs.version.outputs.version }}
tagName: surrealist-v${{ needs.version.outputs.version }}
args: "${{ matrix.settings.args }}"
releaseName: "Surrealist v${{ needs.version.outputs.version }}"
releaseBody: Surrealist update v${{ needs.version.outputs.version }}
releaseDraft: true
prerelease: ${{ inputs.prerelease }}