-
Notifications
You must be signed in to change notification settings - Fork 47
185 lines (161 loc) · 5.99 KB
/
Copy pathbuild.yml
File metadata and controls
185 lines (161 loc) · 5.99 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
# build.yml
name: Auto Build
on:
workflow_dispatch:
inputs:
version:
description: "Version number (e.g., v1.0.0)"
required: true
type: string
build_debug:
description: "Build debug version"
required: false
default: true
type: boolean
push:
branches:
- master
tags:
- "v*" # 只有正式版本标签才触发构建
env:
VERSION: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || github.ref_name }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
permissions:
contents: write
jobs:
pre-build:
name: pre-build go client
runs-on: ubuntu-latest
outputs:
go-client-artifacts: ${{ steps.upload-go-client.outputs.artifact-name }}
steps:
- name: Check out git repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Build Go client for all platforms
run: make build-all
working-directory: go-client
- name: Upload Go client artifacts
id: upload-go-client
uses: actions/upload-artifact@v4
with:
name: go-client-binaries
path: go-client/build/
retention-days: 1
create-release-draft:
name: create latest.json
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
outputs:
release-draft-created: ${{ steps.create-release-draft.outputs.release-draft-created }}
steps:
- name: Check out git repository
uses: actions/checkout@v4
- name: Generate latest.json
shell: bash
run: |
echo '{
"version": "${{ env.VERSION }}",
"notes": "Release ${{ env.VERSION }}",
"pub_date": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'",
"platforms": {
"darwin-x86_64": {
"signature": "",
"url": "https://github.com/jumpserver/clients/releases/download/${{ env.VERSION }}/JumpServerClient_${{ env.VERSION }}_x86_64.dmg"
},
"darwin-aarch64": {
"signature": "",
"url": "https://github.com/jumpserver/clients/releases/download/${{ env.VERSION }}/JumpServerClient_${{ env.VERSION }}_aarch64.dmg"
},
"windows-x86_64": {
"signature": "",
"url": "https://github.com/jumpserver/clients/releases/download/${{ env.VERSION }}/JumpServerClient_${{ env.VERSION }}_x64.exe"
},
"windows-x86_64-msi": {
"signature": "",
"url": "https://github.com/jumpserver/clients/releases/download/${{ env.VERSION }}/JumpServerClient_${{ env.VERSION }}_x64.msi"
}
}
}' > latest.json
- name: Upload latest.json to release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
files: latest.json
fail_on_unmatched_files: true
draft: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: build tauri app
needs: pre-build
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest" # for Arm based macs (M1 and above).
args: "--target aarch64-apple-darwin"
- platform: "macos-latest" # for Intel based macs.
args: "--target x86_64-apple-darwin"
- platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
args: ""
- platform: "windows-latest"
args: ""
runs-on: ${{ matrix.platform }}
steps:
- name: Check out git repository
uses: actions/checkout@v4
- name: Download Go client artifacts
uses: actions/download-artifact@v4
with:
name: go-client-binaries
path: go-client/build/
- name: Install Go client for current platform
run: make install
working-directory: go-client
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "23"
cache: "pnpm"
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Install system dependencies (Ubuntu)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf
- name: Install frontend dependencies
run: pnpm install
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
tagName: ${{ env.VERSION }}
releaseName: "JumpServer Client v__VERSION__"
releaseBody: "See the assets to download this version and install."
releaseDraft: true
prerelease: false
includeDebug: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.build_debug || false }}
includeRelease: ${{ github.event_name == 'workflow_dispatch' && !github.event.inputs.build_debug || github.event_name == 'push' }}