-
Notifications
You must be signed in to change notification settings - Fork 2
130 lines (111 loc) · 4.5 KB
/
builder.yaml
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
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 }}"