Skip to content

2023-12-21 Purple A11y Desktop #156

2023-12-21 Purple A11y Desktop

2023-12-21 Purple A11y Desktop #156

Workflow file for this run

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