-
Notifications
You must be signed in to change notification settings - Fork 89
182 lines (162 loc) · 4.86 KB
/
Copy pathrelease.yml
File metadata and controls
182 lines (162 loc) · 4.86 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
name: Create Tag and Release
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag name'
required: true
type: string
prerelease:
description: 'Mark as pre-release'
required: false
type: boolean
default: false
draft:
description: 'Create as draft'
required: false
type: boolean
default: false
env:
NODE_VERSION: '20'
jobs:
create-tag:
name: Create Git Tag
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create and push tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a ${{ inputs.tag }} -m "Release ${{ inputs.tag }}"
git push origin ${{ inputs.tag }}
build-browser:
name: Build Browser Bundle
needs: create-tag
runs-on: ubuntu-latest
defaults:
run:
working-directory: browser
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: npm install
- name: Build static site
run: npm run build
- name: Create browser archive
run: |
cd dist
zip -r ../nanokvm-usb-browser-${{ inputs.tag }}.zip .
cd ..
- name: Upload browser artifact
uses: actions/upload-artifact@v4
with:
name: browser-release
path: browser/nanokvm-usb-browser-${{ inputs.tag }}.zip
if-no-files-found: error
build-desktop:
name: Build Desktop Apps
needs: create-tag
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: linux
build_script: build:linux-full
artifact_name: desktop-linux
- os: windows-latest
target: windows
build_script: build:win-full
artifact_name: desktop-windows
- os: macos-latest
target: macos-arm64
build_script: build:mac
build_args: --arm64
artifact_name: desktop-macos-arm64
- os: macos-latest
target: macos-x64
build_script: build:mac
build_args: --x64
artifact_name: desktop-macos-x64
defaults:
run:
working-directory: desktop
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install Linux build dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y build-essential python3 libudev-dev rpm
- name: Import Code-Signing Certificates
if: startsWith(matrix.os, 'macos')
uses: apple-actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- name: Install dependencies
run: npm install
- name: Build desktop package
run: npm run ${{ matrix.build_script }}
- name: Upload desktop artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: |
desktop/dist/*.exe
desktop/dist/*.AppImage
desktop/dist/*.deb
desktop/dist/*.rpm
desktop/dist/*.dmg
desktop/dist/*-mac.zip
desktop/dist/latest*.yml
if-no-files-found: error
create-release:
name: Create GitHub Release
needs: [build-browser, build-desktop]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
- name: Display structure of downloaded files
run: ls -R release-artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ inputs.tag }}
name: ${{ inputs.tag }}
draft: ${{ inputs.draft }}
prerelease: ${{ inputs.prerelease }}
files: |
release-artifacts/**/*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}