Skip to content

Install Xcode Command Line Tools onto builder #12

Install Xcode Command Line Tools onto builder

Install Xcode Command Line Tools onto builder #12

Workflow file for this run

name: Electron App Build and Release
on:
push:
branches:
- main
- develop
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
shell: bash
- 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
shell: bash
- 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
shell: bash
- name: Install Development Tools for macOS
if: matrix.os == 'macos-latest'
run: |
xcode-select --install || echo "Xcode Command Line Tools are already installed."
shell: bash
- name: Execute Build Script
shell: pwsh
run: .\build.ps1 -BuildPlatform ${{ matrix.platform }}
- name: Extract package.json Version
shell: pwsh
run: |
$packageJson = Get-Content -Path "./package.json" -Raw | ConvertFrom-Json
echo "PACKAGE_VERSION=$($packageJson.version)" >> $GITHUB_ENV
- name: Define Artifact Path
shell: pwsh
run: |
$platform = "${{ matrix.platform }}"
$version = "${{ env.PACKAGE_VERSION }}"
$artifactPath = ""
if ($platform -eq "windows") {
$artifactPath = "out/make/squirrel.windows/x64/wingman-$version Setup.exe"
} elseif ($platform -eq "linux") {
$artifactPath = "out/make/wingman-$version.deb"
} elseif ($platform -eq "macos") {
$artifactPath = "out/make/wingman-$version-universal.dmg"
}
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/main'
shell: pwsh
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 }}"