1+ name : Create Tag and Release
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ tag :
7+ description : ' Tag name'
8+ required : true
9+ type : string
10+ prerelease :
11+ description : ' Mark as pre-release'
12+ required : false
13+ type : boolean
14+ default : false
15+ draft :
16+ description : ' Create as draft'
17+ required : false
18+ type : boolean
19+ default : false
20+
21+ env :
22+ NODE_VERSION : ' 20'
23+
24+ jobs :
25+ create-tag :
26+ name : Create Git Tag
27+ runs-on : ubuntu-latest
28+ steps :
29+ - name : Checkout
30+ uses : actions/checkout@v4
31+ with :
32+ fetch-depth : 0
33+
34+ - name : Create and push tag
35+ run : |
36+ git config user.name "github-actions[bot]"
37+ git config user.email "github-actions[bot]@users.noreply.github.com"
38+ git tag -a ${{ inputs.tag }} -m "Release ${{ inputs.tag }}"
39+ git push origin ${{ inputs.tag }}
40+
41+ build-browser :
42+ name : Build Browser Bundle
43+ needs : create-tag
44+ runs-on : ubuntu-latest
45+ defaults :
46+ run :
47+ working-directory : browser
48+ steps :
49+ - name : Checkout
50+ uses : actions/checkout@v4
51+ with :
52+ ref : ${{ inputs.tag }}
53+
54+ - name : Setup Node.js
55+ uses : actions/setup-node@v4
56+ with :
57+ node-version : ${{ env.NODE_VERSION }}
58+
59+ - name : Install dependencies
60+ run : npm install
61+
62+ - name : Build static site
63+ run : npm run build
64+
65+ - name : Create browser archive
66+ run : |
67+ cd dist
68+ zip -r ../nanokvm-usb-browser-${{ inputs.tag }}.zip .
69+ cd ..
70+
71+ - name : Upload browser artifact
72+ uses : actions/upload-artifact@v4
73+ with :
74+ name : browser-release
75+ path : browser/nanokvm-usb-browser-${{ inputs.tag }}.zip
76+ if-no-files-found : error
77+
78+ build-desktop :
79+ name : Build Desktop Apps
80+ needs : create-tag
81+ runs-on : ${{ matrix.os }}
82+ strategy :
83+ fail-fast : false
84+ matrix :
85+ include :
86+ - os : ubuntu-latest
87+ target : linux
88+ build_script : build:linux-full
89+ artifact_name : desktop-linux
90+ - os : windows-latest
91+ target : windows
92+ build_script : build:win-full
93+ artifact_name : desktop-windows
94+ defaults :
95+ run :
96+ working-directory : desktop
97+ env :
98+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
99+ steps :
100+ - name : Checkout
101+ uses : actions/checkout@v4
102+ with :
103+ ref : ${{ inputs.tag }}
104+
105+ - name : Setup Node.js
106+ uses : actions/setup-node@v4
107+ with :
108+ node-version : ${{ env.NODE_VERSION }}
109+
110+ - name : Install Linux build dependencies
111+ if : matrix.os == 'ubuntu-latest'
112+ run : |
113+ sudo apt-get update
114+ sudo apt-get install -y build-essential python3 libudev-dev rpm
115+
116+ - name : Install dependencies
117+ run : npm install
118+
119+ - name : Build desktop package
120+ run : npm run ${{ matrix.build_script }}
121+
122+ - name : Upload desktop artifacts
123+ uses : actions/upload-artifact@v4
124+ with :
125+ name : ${{ matrix.artifact_name }}
126+ path : |
127+ desktop/dist/*.exe
128+ desktop/dist/*.AppImage
129+ desktop/dist/*.deb
130+ desktop/dist/*.rpm
131+ desktop/dist/latest*.yml
132+ if-no-files-found : error
133+
134+ create-release :
135+ name : Create GitHub Release
136+ needs : [build-browser, build-desktop]
137+ runs-on : ubuntu-latest
138+ permissions :
139+ contents : write
140+ steps :
141+ - name : Download all artifacts
142+ uses : actions/download-artifact@v4
143+ with :
144+ path : release-artifacts
145+
146+ - name : Display structure of downloaded files
147+ run : ls -R release-artifacts
148+
149+ - name : Create Release
150+ uses : softprops/action-gh-release@v1
151+ with :
152+ tag_name : ${{ inputs.tag }}
153+ name : ${{ inputs.tag }}
154+ draft : ${{ inputs.draft }}
155+ prerelease : ${{ inputs.prerelease }}
156+ files : |
157+ release-artifacts/**/*
158+ generate_release_notes : true
159+ env :
160+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments