-
Notifications
You must be signed in to change notification settings - Fork 180
155 lines (131 loc) · 4.29 KB
/
build.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
name: Builder
on:
push:
pull_request:
schedule:
- cron: '0 13 * * *' # run at 1 PM UTC
workflow_dispatch:
inputs:
release:
type: choice
description: Release the asset
default: 'none'
options:
- none
- prerelease
- release
permissions:
contents: write
jobs:
build:
name: Build PluginLoader
runs-on: ubuntu-latest
steps:
- name: Checkout 🧰
uses: actions/checkout@v3
- name: Set up NodeJS 17 💎
uses: actions/setup-node@v3
with:
node-version: 17
- name: Set up Python 3.10 🐍
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install Python dependencies ⬇️
run: |
python -m pip install --upgrade pip
pip install pyinstaller
[ -f requirements.txt ] && pip install -r requirements.txt
- name: Install NodeJS dependencies ⬇️
run: |
cd frontend
npm i
npm run build
- name: Build 🛠️
run: pyinstaller --noconfirm --onefile --name "PluginLoader" --add-data ./backend/static:/static --add-data ./backend/legacy:/legacy ./backend/*.py
- name: Upload package artifact ⬆️
uses: actions/upload-artifact@v3
with:
name: PluginLoader
path: ./dist/PluginLoader
release:
name: Release the package
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'release' }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout 🧰
uses: actions/checkout@v3
- name: Fetch package artifact ⬇️
uses: actions/download-artifact@v3
with:
name: PluginLoader
path: dist
- name: Bump version and push tag ⏫
id: tag_version
uses: mathieudutour/github-tag-action@v6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Release 📦
uses: softprops/action-gh-release@v1
with:
name: Release ${{ steps.tag_version.outputs.new_tag }}
tag_name: ${{ steps.tag_version.outputs.new_tag }}
files: ./dist/PluginLoader
generate_release_notes: true
nightly:
name: Release the nightly version of the package
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'prerelease') }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout 🧰
uses: actions/checkout@v3
- name: Fetch package artifact ⬇️
uses: actions/download-artifact@v3
with:
name: PluginLoader
path: dist
- name: Bump version ⏫
id: tag_version
uses: mathieudutour/github-tag-action@v6.0
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
- name: Push tag ⏫
uses: rickstaa/action-create-tag@v1.3.2
if: ${{ steps.tag_version.outputs.new_tag && github.event_name == 'workflow_dispatch' }}
with:
tag: ${{ steps.tag_version.outputs.new_tag }}-pre
message: Nightly ${{ steps.tag_version.outputs.new_tag }}
- name: Release 📦
uses: softprops/action-gh-release@v1
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
name: Nightly ${{ steps.tag_version.outputs.new_tag }}
tag_name: ${{ steps.tag_version.outputs.new_tag }}-pre
files: ./dist/PluginLoader
prerelease: true
generate_release_notes: true
- name: Bump prerelease
id: bump
if: ${{ github.event_name == 'schedule' }}
run: |
git_hash=$(git rev-parse --short "$GITHUB_SHA")
echo ::set-output new_tag="nightly-$git_hash"
- name: Push tag ⏫
uses: rickstaa/action-create-tag@v1.3.2
if: ${{ github.event_name == 'schedule' }}
with:
tag: ${{ steps.bump.outputs.new_tag }}
message: Nightly ${{ steps.bump.outputs.new_tag }}
- name: Release 📦
uses: softprops/action-gh-release@v1
if: ${{ github.event_name == 'schedule' }}
with:
name: Nightly ${{ steps.bump.outputs.new_tag }}
tag_name: ${{ steps.bump.outputs.new_tag }}
files: ./dist/PluginLoader
prerelease: true
generate_release_notes: true