-
Notifications
You must be signed in to change notification settings - Fork 8
135 lines (120 loc) · 5 KB
/
workflow-package.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
name: Package Workflow
# Workflow dispatch for packaging an electron executable
on:
workflow_dispatch:
inputs:
setting:
type: choice
options:
- "home"
- "clinic"
default: "home"
required: true
description: Package the app for 'home' or 'clinic' use
os:
type: choice
options:
- "All"
- "Windows"
- "macOS"
- "Linux"
default: "All"
required: true
description: Which OS to package
jobs:
package-and-upload:
name: Package and Upload
runs-on: ${{ matrix.os }}
# Run action for [home/clinic] in [windows/macOS/ubuntu] based on user input
strategy:
matrix:
os: ${{
(github.event.inputs.os == 'All' && fromJSON('["ubuntu-latest", "macOS-latest", "windows-latest"]')) ||
(github.event.inputs.os == 'Windows' && fromJSON('["windows-latest"]')) ||
(github.event.inputs.os == 'macOS' && fromJSON('["macOS-latest"]')) ||
(github.event.inputs.os == 'Linux' && fromJSON('["ubuntu-latest"]')) }}
fail-fast: false # A failed build will not end the other matrix jobs
steps:
# Set up runner
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
# TEMP: Test Windows
- name: Get package name and version
id: test
run: |
echo "name=$(cat package.json | jq -r '.name')" >> $GITHUB_OUTPUT
echo "version=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
- run: echo "name=$(cat package.json | jq -r '.name')"
- run: echo "version=$(cat package.json | jq -r '.version')"
- run: echo "${{steps.test.outputs.name}}-${{ steps.test.outputs.version }}"
- run: ${{steps.test.outputs}}
# TEMP - CHECK CORRECT PATHS
- name: Echo Paths
run: echo out/make/squirrel.windows/x64/${{steps.test.outputs.name}}-${{ steps.test.outputs.version }} Setup.exe
- 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.${{github.event.inputs.setting}})
uses: xom9ikk/dotenv@v2
with:
path: ./env
mode: ${{github.event.inputs.setting}}
# Build the app
- name: ⚒ Run 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')
run: npm run package:mac
- name: 📦 Package app installer - Linux
if: startsWith(matrix.os, 'ubuntu')
run: npm run package:linux
# Upload installers to github action
# - name: Set package version and name
# uses: brown-ccv/gh-actions/get-package-info@main
# id: package_info
# TODO: echo isn't working on Windows
- 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
# TEMP - CHECK CORRECT PATHS
- name: Echo Paths
run: |
echo out/make/squirrel.windows/x64/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }} Setup.exe
echo out/make/squirrel.windows/x64/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }} Setup.exe
echo out/make/deb/x64/${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_amd64.deb
- name: ⬆ Upload installer - Windows
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'windows')
with:
name: ${{ format('win-installer-{0}', github.event.inputs.setting) }}
path: out/make/squirrel.windows/x64/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }} Setup.exe
if-no-files-found: error
- name: ⬆ Upload installer - Mac
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'mac')
with:
name: ${{ format('mac-installer-{0}', github.event.inputs.setting) }}
path: out/make/${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}-x64.dmg
if-no-files-found: error
- name: ⬆ Upload installer - Linux
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'ubuntu')
with:
name: ${{ format('linux-installer-{0}', github.event.inputs.setting) }}
path: out/make/deb/x64/${{ steps.package_info.outputs.name }}_${{ steps.package_info.outputs.version }}_amd64.deb
if-no-files-found: error