Build MacOS and Windows image #262
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}}\oobee-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\Oobee-win32-x64" -Destination "${{github.workspace}}\Oobee-win32-x64" -Force | |
- name: Download Oobee Backend | |
shell: pwsh | |
run: | | |
$PHbackendUrl = "https://github.com/GovTechSG/oobee/releases/download/${{ vars.BE_TAG }}/oobee-portable-windows.zip" | |
$BEdestinationPath = "${{github.workspace}}\PHLatest.zip" | |
$BEextractPath = "D:\a\Oobee 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\Oobee-setup.exe | |
working-directory: ${{github.workspace}} | |
- name: Zip Setup file (Windows) | |
shell: pwsh | |
run: Compress-Archive -Path ${{github.workspace}}/setup/* -DestinationPath oobee-desktop-windows.zip | |
working-directory: ${{github.workspace}} | |
- name: Upload Oobee Windows setup artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: oobee-desktop-windows | |
path: oobee-desktop-windows.zip | |
- name: Release Windows artifact | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
oobee-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/oobee-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}}/oobee-desktop-macos.zip" | |
working-directory: ${{github.workspace}}/out/make/zip/darwin/universal | |
- name: Upload Mac artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: oobee-desktop-macos | |
path: oobee-desktop-macos.zip | |
- name: Release Mac artifact | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
oobee-desktop-macos.zip |