Skip to content

Build setup continues on error #15

Build setup continues on error

Build setup continues on error #15

Workflow file for this run

name: Electron App Build and Release
on:
push:
branches:
- develop
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
jobs:
build-and-release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
platform: windows
- os: ubuntu-latest
platform: linux
- os: macos-latest
platform: macos
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20' # Specify the Node.js version to use, ensure it matches your project requirements
- name: Detect macOS Processor Type
if: runner.os == 'macOS'
run: |
architecture=$(uname -m)
echo "ARCHITECTURE=$architecture" >> $GITHUB_ENV
- name: Set VCPKG Environment Variables
run: |
echo "VCPKG_ROOT=${VCPKG_INSTALLATION_ROOT}" >> $GITHUB_ENV
if [[ ${{ runner.os }} == 'Windows' ]]; then
echo "VCPKG_DEFAULT_TRIPLET=x64-windows" >> $GITHUB_ENV
elif [[ ${{ runner.os }} == 'Linux' ]]; then
echo "VCPKG_DEFAULT_TRIPLET=x64-linux" >> $GITHUB_ENV
elif [[ ${{ runner.os }} == 'macOS' ]]; then
architecture=$(uname -m)
if [[ "$architecture" == "x86_64" ]]; then
echo "VCPKG_DEFAULT_TRIPLET=x64-osx" >> $GITHUB_ENV
elif [[ "$architecture" == "arm64" ]]; then
echo "VCPKG_DEFAULT_TRIPLET=arm64-osx" >> $GITHUB_ENV
fi
fi
- name: Install PowerShell on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb"
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y powershell
- name: Install PowerShell macOS
if: matrix.os == 'macos-latest'
run: |
architecture=$(uname -m)
if [ "$architecture" = "x86_64" ]; then
echo "Running on Intel processor"
# Place your Intel-specific commands here
elif [ "$architecture" = "arm64" ]; then
echo "Running on Apple processor"
# Place your Apple Silicon-specific commands here
else
echo "Unknown architecture: $architecture"
fi
# Download the powershell '.tar.gz' archive
if [ "$architecture" = "x86_64" ]; then
curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/powershell-7.4.1-osx-x64.tar.gz
elif [ "$architecture" = "arm64" ]; then
curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/powershell-7.4.1-osx-arm64.tar.gz
fi
# Create the target folder where powershell is placed
sudo mkdir -p /usr/local/microsoft/powershell/7
# Expand powershell to the target folder
sudo tar zxf /tmp/powershell.tar.gz -C /usr/local/microsoft/powershell/7
# Set execute permissions
sudo chmod +x /usr/local/microsoft/powershell/7/pwsh
# Create the symbolic link that points to pwsh
sudo ln -sf /usr/local/microsoft/powershell/7/pwsh /usr/local/bin/pwsh
- name: Install Development Tools for macOS
if: matrix.os == 'macos-latest'
run: |
xcode-select --install || echo "Xcode Command Line Tools are already installed."
- name: Install Dependencies
shell: pwsh
run: .\build-setup.ps1 -BuildPlatform ${{ matrix.platform }}
- name: Execute Build Script
shell: pwsh
run: .\build.ps1 -BuildPlatform ${{ matrix.platform }}
- name: Extract package.json Version
run: |
package_version=$(jq -r '.version' ./package.json)
echo "PACKAGE_VERSION=$package_version" >> $GITHUB_ENV
- name: Define Artifact Path
run: |
platform="${{ matrix.platform }}"
version="${{ env.PACKAGE_VERSION }}"
artifactPath=""
if [ "$platform" = "windows" ]; then
artifactPath="out/make/squirrel.windows/x64/app-$version Setup.exe"
elif [ "$platform" = "linux" ]; then
artifactPath="out/make/app-$version.deb"
elif [ "$platform" = "macos" ]; then
artifactPath="out/make/app-$version-universal.dmg"
fi
echo "ARTIFACT_PATH=$artifactPath" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: app-${{ matrix.platform }}-${{ env.PACKAGE_VERSION }}
path: ${{ env.ARTIFACT_PATH }}
- name: Create and Push Git Tag
if: github.ref == 'refs/heads/develop'
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git tag -a "v${{ env.PACKAGE_VERSION }}" -m "Release version ${{ env.PACKAGE_VERSION }}"
git push origin "v${{ env.PACKAGE_VERSION }}"