-
Notifications
You must be signed in to change notification settings - Fork 2
169 lines (150 loc) · 6.49 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
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:
# fail-fast: false
matrix:
# os: [windows-latest, ubuntu-latest, macos-latest]
os: [windows-latest, macos-latest]
include:
- os: windows-latest
platform: windows
timeout-minutes: 60
# - os: ubuntu-latest
# platform: linux
# timeout-minutes: 60
- os: macos-latest
platform: macos
runs-on: macos-14
timeout-minutes: 60
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
- uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Set VCPKG Environment Variables
run: |
echo "VCPKG_ROOT=${VCPKG_INSTALLATION_ROOT}" >> $GITHUB_ENV
- name: Install PowerShell macOS
if: matrix.os == 'macos-latest'
run: |
architecture=$(uname -m)
# 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 Build Dependencies
shell: pwsh
run: .\build-setup.ps1 -BuildPlatform ${{ matrix.platform }}
- name: Cache npm dependencies
uses: actions/cache@v2
with:
path: '~/.npm'
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Execute Build Script
shell: pwsh
run: .\build.ps1 -BuildPlatform ${{ matrix.platform }}
env:
VCPKG_ROOT: ${{ env.VCPKG_ROOT }}
- name: Extract package.json Version
run: |
package_version=$(jq -r '.version' ./package.json)
echo "PACKAGE_VERSION=$package_version" >> $GITHUB_ENV
- name: Define Artifact Path for Windows and Linux
if: matrix.os != 'macos-latest'
run: |
platform="${{ matrix.platform }}"
version="${{ env.PACKAGE_VERSION }}"
artifactPath=""
artifactZipPath=""
if [ "$platform" = "windows" ]; then
artifactPath="out/make/squirrel.windows/x64/wingman-$version Setup.exe"
artifactZipPath="out/make/zip/win32/x64/wingman-win32-x64-$version.zip"
elif [ "$platform" = "linux" ]; then
artifactPath="out/make/wingman-linux-x64-$version.deb"
artifactZipPath="out/make/zip/linux/x64/wingman-linux-x64-$version.zip"
fi
echo "ARTIFACT_PATH=$artifactPath" >> $GITHUB_ENV
echo "ARTIFACT_ZIP_PATH=$artifactZipPath" >> $GITHUB_ENV
- name: Define Artifact Paths for macOS
if: matrix.os == 'macos-latest'
run: |
version="${{ env.PACKAGE_VERSION }}"
arch="x64"
echo "ARTIFACT_PATH_INTEL=out/make/wingman-$arch-$version.dmg" >> $GITHUB_ENV
echo "ARTIFACT_PATH_INTEL_ZIP=out/make/zip/darwin/$arch/wingman-$arch-$version.dmg" >> $GITHUB_ENV
arch="arm64"
echo "ARTIFACT_PATH_APPLE_SILICON=out/make/wingman-$arch-$version.dmg" >> $GITHUB_ENV
echo "ARTIFACT_PATH_APPLE_SILICON_ZIP=out/make/zip/darwin/$arch/wingman-darwin-$arch-$version.dmg" >> $GITHUB_ENV
- name: Upload Installer Artifact for Intel macOS
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v2
with:
name: wingman-macos-intel-${{ env.PACKAGE_VERSION }}
path: ${{ env.ARTIFACT_PATH_INTEL }}
- name: Upload Zip Artifact for Intel macOS
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v2
with:
name: wingman-macos-intel-zip-${{ env.PACKAGE_VERSION }}
path: ${{ env.ARTIFACT_PATH_INTEL_ZIP }}
- name: Upload Installer Artifact for Apple Silicon macOS
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v2
with:
name: wingman-macos-apple-silicon-${{ env.PACKAGE_VERSION }}
path: ${{ env.ARTIFACT_PATH_APPLE_SILICON }}
- name: Upload Zip Artifact for Apple Silicon macOS
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v2
with:
name: wingman-macos-apple-silicon-${{ env.PACKAGE_VERSION }}
path: ${{ env.ARTIFACT_PATH_APPLE_SILICON_ZIP }}
- name: Upload Installer Artifact for Windows and Linux
if: matrix.os != 'macos-latest'
uses: actions/upload-artifact@v2
with:
name: wingman-${{ matrix.platform }}-${{ env.PACKAGE_VERSION }}
path: ${{ env.ARTIFACT_PATH }}
- name: Upload Zip Artifact for Windows and Linux
if: matrix.os != 'macos-latest'
uses: actions/upload-artifact@v2
with:
name: wingman-zip-${{ matrix.platform }}-${{ env.PACKAGE_VERSION }}
path: ${{ env.ARTIFACT_PATH_ZIP }}
- 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 }}"