-
Notifications
You must be signed in to change notification settings - Fork 6
153 lines (129 loc) · 5.73 KB
/
image.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
name: Build MacOS and Windows image
on:
workflow_dispatch:
release:
types: [published]
jobs:
windows-install-purple:
runs-on: windows-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Enable Long File Path in Registry
shell: pwsh
run: |
Start-Process powershell -Verb runAs -ArgumentList 'New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -PropertyType "DWORD" -Value "1"'
- name: Download node.js version from nodejs.org
run: |
curl -o ./nodejs-win.zip --create-dirs https://nodejs.org/dist/v20.10.0/node-v20.10.0-win-x64.zip
mkdir nodejs-win && tar -xzf nodejs-win.zip -C nodejs-win --strip-components=1 && rm ./nodejs-win.zip
working-directory: ${{github.workspace}}
- name: Download Inno Setup
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://jrsoftware.org/download.php/is.exe" -OutFile "${{github.workspace}}\is.exe"
$env:path = "$env:path" + ";${env:programfiles(x86)}\Inno Setup 6"
- name: Install Node Modules and Build for Windows
run: |
$env:Path = "${{github.workspace}}\nodejs-win;${{github.workspace}}\purple-a11y-desktop\node_modules\.bin;$env:Path;";
npm install
npm run make-win
env:
CI: ""
working-directory: ${{github.workspace}}
- name: Move build to root
shell: pwsh
run: |
Move-Item "${{github.workspace}}\out\Purple A11y-win32-x64" -Destination "${{github.workspace}}\Purple A11y-win32-x64" -Force
- name: Download Purple A11y Backend
shell: pwsh
run: |
$PHbackendUrl = "https://github.com/GovTechSG/purple-a11y/releases/download/${{ vars.BE_TAG }}/purple-a11y-portable-windows.zip"
$BEdestinationPath = "${{github.workspace}}\PHLatest.zip"
$BEextractPath = "D:\a\Purple A11y Backend"
Invoke-WebRequest -Uri $PHbackendUrl -OutFile $BEdestinationPath
Expand-Archive -Path $BEdestinationPath -DestinationPath $BEextractPath -Force
Remove-Item -Path $BEdestinationPath
- name: Execute Inno Setup script to compile installer
shell: pwsh
run: ISCC /O"${{github.workspace}}" "${{github.workspace}}\a11y_for_windows.iss"
- name: Move compiled installer to Workspace
run: |
New-Item -Path setup -ItemType Directory
Move-Item -Path mysetup.exe -Destination setup\Purple-A11y-Setup.exe
working-directory: ${{github.workspace}}
- name: Zip Setup file (Windows)
shell: pwsh
run: Compress-Archive -Path ${{github.workspace}}/setup/* -DestinationPath purple-a11y-desktop-windows.zip
working-directory: ${{github.workspace}}
- name: Upload Purple A11y Windows setup artifact
uses: actions/upload-artifact@v3
with:
name: purple-a11y-desktop-windows
path: purple-a11y-desktop-windows.zip
- name: Release Windows artifact
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
purple-a11y-desktop-windows.zip
mac-install-purple:
runs-on: self-hosted
environment: macos
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Clean Workspace Folder
run: |
rm -rf ./* || true
rm -rf ./.??* || true
- name: Check out repository code
uses: actions/checkout@v3
with:
path: ${{github.workspace}}
- name: Download node.js version from nodejs.org
run: |
curl -o ./nodejs-mac-arm64.tar.gz --create-dirs https://nodejs.org/dist/v20.10.0/node-v20.10.0-darwin-arm64.tar.gz
mkdir nodejs-mac-arm64 && tar -xzf nodejs-mac-arm64.tar.gz -C nodejs-mac-arm64 --strip-components=1 && rm ./nodejs-mac-arm64.tar.gz
curl -o ./nodejs-mac-x64.tar.gz --create-dirs https://nodejs.org/dist/v20.10.0/node-v20.10.0-darwin-x64.tar.gz
mkdir nodejs-mac-x64 && tar -xzf nodejs-mac-x64.tar.gz -C nodejs-mac-x64 --strip-components=1 && rm ./nodejs-mac-x64.tar.gz
working-directory: ${{github.workspace}}
- name: Set environment variables for Node
run: |
if [[ $(uname -m) == 'arm64' ]]; then
export PATH_TO_NODE="${{github.workspace}}/nodejs-mac-arm64/bin"
else
export PATH_TO_NODE="${{github.workspace}}/nodejs-mac-x64/bin"
fi
export PATH="$PATH_TO_NODE:$PATH"
export PATH="$PWD/purple-a11y-desktop/node_modules/.bin:$PATH"
env:
CI: ""
working-directory: ${{github.workspace}}
- name: Install Node Modules and Build for Mac0S
run: |
npm install
npm run make-mac
env:
CI: ""
BE_TAG: "${{ vars.BE_TAG }}"
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
working-directory: ${{github.workspace}}
- name: Move and rename universal binary zip (Mac)
run: |
mv *.zip "${{github.workspace}}/purple-a11y-desktop-macos.zip"
working-directory: ${{github.workspace}}/out/make/zip/darwin/universal
- name: Upload Mac artifact
uses: actions/upload-artifact@v3
with:
name: purple-a11y-desktop-macos
path: purple-a11y-desktop-macos.zip
- name: Release Mac artifact
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
purple-a11y-desktop-macos.zip