-
Notifications
You must be signed in to change notification settings - Fork 8
195 lines (173 loc) · 6.74 KB
/
release.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
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
name: 🚀 Release
# Runs the build and package scripts when a new tagged release is created
# Note that this runs for both releases and pre-releases: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
on:
release:
# TODO @brown-ccv: I need to figure out which ones to do here?
# TODO @brown-ccv: Should occur whenever a release is created or edited, prelease or otherwise
# types: created
types: [created, edited, prereleased]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
package-and-upload:
name: Package and Upload
runs-on: ${{ matrix.os }}
# Run build script for [home/clinic] in [windows/macOS/ubuntu]+
# TODO @brown-ccv: Split OS as seperate jobs with matrix for just the build environments
strategy:
matrix:
setting: [home, clinic]
os: [windows-latest, macOS-latest, ubuntu-latest]
fail-fast: true
steps:
# Set up runner
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
# Install dependencies and set up environment
- name: 📥 Install Dependencies
run: npm ci
- name: 🔃 Load .env file (.env.${{matrix.setting}})
uses: xom9ikk/dotenv@v2
with:
path: ./env
mode: ${{matrix.setting}}
# Build the app
- name: ⚒ Build
run: npm run build
# Package the app installers
- name: 📦 Package app installer - Windows
if: startsWith(matrix.os, 'windows')
run: npm run package:windows
- name: 📦 Package app installer - Mac
if: startsWith(matrix.os, 'mac')
# TODO @brown-ccv #318: Universal may not work between Intel and Apple Silicon?
# TODO @brown-ccv #318: Will have to run seperate makes for `arm64` and `x64`
run: npm run package:mac
- name: 📦 Package app installer - Linux
if: startsWith(matrix.os, 'ubuntu')
run: npm run package:linux
# TEMP
# TODO: Delete
- name: "LS Directory"
run: ls -R out/
# Get package info
- name: Get package name and version
id: package_info
run: |
echo "name=$(cat package.json | jq -r '.name')" >> $GITHUB_OUTPUT
echo "version=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
shell: bash
# Upload installers to github release
- name: ⬆ Upload installer to release - Windows
if: startsWith(matrix.os, 'windows')
uses: svenstaro/upload-release-action@v2
with:
file: out/make/squirrel.windows/x64/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }} Setup.exe
asset_name: ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-${{ matrix.setting }}-setup.exe
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: ⬆ Upload installer to release - macOS
if: startsWith(matrix.os, 'mac')
uses: svenstaro/upload-release-action@v2
with:
file: out/make/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-x64.dmg
asset_name: ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-${{ matrix.setting }}-universal.dmg
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: ⬆ Upload installer to release - Linux
if: startsWith(matrix.os, 'ubuntu')
uses: svenstaro/upload-release-action@v2
with:
file: out/make/deb/x64/${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_amd64.deb
asset_name: ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-${{ matrix.setting }}-amd64.deb
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
# TODO @brown-ccv: This should only run on "latest-release" tag on main
deploy-gh-pages:
name: Deploy to GH Pages
runs-on: ubuntu-latest
steps:
# Set up runner
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
# Install dependencies
- name: 📥 Install Dependencies
run: npm ci
# Build the app
- name: ⚒ Build
run: npm run build
# Deploy the app to GitHub Pages
- name: 🚀 Deploy to GH Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
package-psiturk:
name: Package for PsiTurk
runs-on: ubuntu-latest
steps:
# Set up runner
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: npm
- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
# Install dependencies
- name: 📥 Install Dependencies
run: npm ci
- name: 📥 Install PsiTurk
run: pip install psiturk
# Build the app
- name: ⚒ Build
run: npm run build
# Get package info
- name: Get package name and version
id: package_info
run: |
echo "name=$(cat package.json | jq -r '.name')" >> $GITHUB_OUTPUT
echo "version=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
shell: bash
# Package with PsiTurk
- name: 📦 Create Psiturk Build
run: |
cd psiturkit
./psiturk-it -p ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-psiturk
# Zip and upload the package
- name: Zip psiturk folder
run: |
cd psiturkit
zip -r ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-psiturk.zip ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-psiturk
- name: ⬆ Upload PsiTurk Build
uses: svenstaro/upload-release-action@v2
with:
file: psiturkit/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-psiturk.zip
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}