-
Notifications
You must be signed in to change notification settings - Fork 2
245 lines (220 loc) · 7.83 KB
/
Copy pathrelease.yml
File metadata and controls
245 lines (220 loc) · 7.83 KB
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
name: Release
on:
push:
branches: [master]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-version:
name: Check Version Bump
runs-on: ubuntu-latest
outputs:
is_new_version: ${{ steps.check.outputs.is_new_version }}
version: ${{ steps.check.outputs.version }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Check if version is new
id: check
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=${VERSION}" >> $GITHUB_OUTPUT
if git tag --list | grep -q "^v${VERSION}$"; then
echo "Tag v${VERSION} already exists, skipping release"
echo "is_new_version=false" >> $GITHUB_OUTPUT
else
echo "Tag v${VERSION} not found, proceeding with release"
echo "is_new_version=true" >> $GITHUB_OUTPUT
fi
prepare:
name: Prepare Release
needs: check-version
if: needs.check-version.outputs.is_new_version == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
release_body: ${{ steps.release_notes.outputs.release_body }}
release_id: ${{ steps.create-release.outputs.result }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Build Release Notes
id: release_notes
run: |
bash scripts/build-release-notes.sh
{
echo 'release_body<<EOF'
cat release-notes.md
echo EOF
} >> $GITHUB_OUTPUT
- name: Create draft release
id: create-release
uses: actions/github-script@v7
env:
VERSION: ${{ needs.check-version.outputs.version }}
RELEASE_BODY: ${{ steps.release_notes.outputs.release_body }}
with:
script: |
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `v${process.env.VERSION}`,
name: `SqlKit v${process.env.VERSION}`,
body: process.env.RELEASE_BODY || '',
draft: true,
prerelease: false
})
return data.id
build:
name: ${{ matrix.name }}
needs: [check-version, prepare]
if: needs.check-version.outputs.is_new_version == 'true'
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- name: macOS
platform: macos-latest
args: --target universal-apple-darwin
target: aarch64-apple-darwin,x86_64-apple-darwin
- name: Windows
platform: windows-latest
args: ''
target: x86_64-pc-windows-msvc
- name: Linux
platform: ubuntu-latest
args: ''
target: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Setup Node
uses: actions/setup-node@v5
with:
node-version: lts/*
cache: npm
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev
- name: Install dependencies
run: npm ci
- name: Lint check
run: npm run lint:check
- name: Run tests
run: npm run test:ci
- name: Build frontend
run: npm run build
- name: Import Apple Developer Certificate
if: runner.os == 'macOS'
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
run: |
echo $APPLE_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p "SqlKit2024!" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "SqlKit2024!" build.keychain
security set-keychain-settings -t 3600 -u build.keychain
security import certificate.p12 -k build.keychain -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "SqlKit2024!" build.keychain
- name: Extract Signing Identity
if: runner.os == 'macOS'
run: |
CERT_INFO=$(security find-identity -v -p codesigning build.keychain | grep "Apple Development" || security find-identity -v -p codesigning build.keychain | grep "Developer ID")
CERT_ID=$(echo "$CERT_INFO" | awk -F'"' '{print $2}')
echo "CERT_ID=$CERT_ID" >> $GITHUB_ENV
echo "Signing identity: $CERT_ID"
- name: Build and Upload Artifacts
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ env.CERT_ID }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
releaseId: ${{ needs.prepare.outputs.release_id }}
includeUpdaterJson: true
args: ${{ matrix.args }}
build-bridge:
name: Build JDBC Bridge
needs: [check-version, prepare]
if: needs.check-version.outputs.is_new_version == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- name: Setup JDK 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: temurin
cache: maven
- name: Build bridge JAR
run: |
VERSION=${{ needs.check-version.outputs.version }}
mvn -f jdbc-bridge/pom.xml clean package -DskipTests -Drevision=$VERSION
- name: Upload bridge JAR artifact
uses: actions/upload-artifact@v4
with:
name: jdbc-bridge
path: jdbc-bridge/target/jdbc-bridge-*.jar
if-no-files-found: error
publish:
name: Publish Release
needs: [check-version, prepare, build, build-bridge]
if: needs.check-version.outputs.is_new_version == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- name: Download bridge JAR artifact
uses: actions/download-artifact@v4
with:
name: jdbc-bridge
path: bridge-artifact
- name: Prepare bridge JAR for upload
run: |
VERSION=${{ needs.check-version.outputs.version }}
ls -la bridge-artifact/
- name: Upload bridge JAR to release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=${{ needs.check-version.outputs.version }}
gh release upload \
v${{ needs.check-version.outputs.version }} \
bridge-artifact/jdbc-bridge-${VERSION}.jar \
--clobber
- name: Publish draft release
uses: actions/github-script@v7
env:
release_id: ${{ needs.prepare.outputs.release_id }}
with:
script: |
github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: Number(process.env.release_id),
draft: false,
prerelease: false
})