-
Notifications
You must be signed in to change notification settings - Fork 0
172 lines (150 loc) · 5.64 KB
/
Copy pathnative-build.yml
File metadata and controls
172 lines (150 loc) · 5.64 KB
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
170
171
172
name: Native Builds
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
version:
description: 'App version (e.g. 1.0.1). Defaults to tag or 0.0.0-dev.'
required: false
type: string
permissions:
contents: write
jobs:
build:
name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}
# mac "all" builds arm64 + x64 in one electron-builder run so latest-mac.yml lists both.
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
platform: mac
arch: all
label: macOS (arm64 + x64)
- os: windows-latest
platform: win
arch: x64
label: Windows x64
env:
# Bake GitHub Releases updater into production builds (electron-builder publish config).
NATIVEPHP_UPDATER_ENABLED: true
NATIVEPHP_UPDATER_PROVIDER: github
GITHUB_OWNER: CodeWithDennis
GITHUB_REPO: pairframe
GITHUB_PRIVATE: false
GITHUB_V_PREFIXED_TAG_NAME: true
GITHUB_CHANNEL: latest
GITHUB_RELEASE_TYPE: release
# Do not set GITHUB_TOKEN / GH_TOKEN here: builds use native:build (not --publish).
# A write token in the build env risks ending up in updater/publish metadata.
# Unsigned CI builds until Apple / Windows signing secrets are configured.
CSC_IDENTITY_AUTO_DISCOVERY: false
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: '8.4'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, fileinfo
coverage: none
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: lts/*
cache: npm
- name: Install Composer dependencies
run: composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev
- name: Install Node dependencies
run: npm ci
- name: Prepare application
shell: bash
run: |
cp .env.example .env
php artisan key:generate --force
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
elif [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
VERSION="${GITHUB_REF_NAME#v}"
else
VERSION="0.0.0-dev"
fi
{
echo "NATIVEPHP_APP_VERSION=${VERSION}"
echo "NATIVEPHP_UPDATER_ENABLED=true"
echo "NATIVEPHP_UPDATER_PROVIDER=github"
echo "GITHUB_OWNER=CodeWithDennis"
echo "GITHUB_REPO=pairframe"
echo "GITHUB_PRIVATE=false"
echo "GITHUB_V_PREFIXED_TAG_NAME=true"
echo "GITHUB_CHANNEL=latest"
echo "GITHUB_RELEASE_TYPE=release"
} >> .env
echo "Building Pairframe ${VERSION} for ${{ matrix.platform }}-${{ matrix.arch }}"
# Do not use --publish: NativePHP's electronPath($subpath) resolves published
# roots incorrectly, so icons would land in vendor while electron-builder
# still packs the default NativePHP icon from nativephp/electron/build.
- name: Install NativePHP Electron scaffold
run: php artisan native:install --force --no-interaction
- name: Install app icons into Electron build resources
shell: bash
run: |
for dir in \
"vendor/nativephp/desktop/resources/electron/build" \
"vendor/nativephp/desktop/resources/build" \
"nativephp/electron/build"
do
mkdir -p "$dir"
cp public/icon.png "$dir/icon.png"
# Prefer regenerating platform icons from our PNG
rm -f "$dir/icon.icns" "$dir/icon.ico"
done
- name: Build frontend assets
run: npm run build
- name: Build native app
run: php artisan native:build ${{ matrix.platform }} ${{ matrix.arch }} --no-interaction
- name: List build output
shell: bash
run: ls -lah nativephp/electron/dist/ || true
- name: Upload build artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pairframe-${{ matrix.platform }}-${{ matrix.arch }}
path: |
nativephp/electron/dist/*.dmg
nativephp/electron/dist/*.zip
nativephp/electron/dist/*.exe
nativephp/electron/dist/*.AppImage
nativephp/electron/dist/*.deb
nativephp/electron/dist/*.yml
nativephp/electron/dist/*.blockmap
if-no-files-found: warn
retention-days: 14
release:
name: Attach to GitHub Release
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
path: artifacts
merge-multiple: true
- name: List release files
run: find artifacts -type f | sort
- name: Create / update GitHub Release
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2
with:
generate_release_notes: true
files: |
artifacts/**/*.dmg
artifacts/**/*.zip
artifacts/**/*.exe
artifacts/**/*.AppImage
artifacts/**/*.deb
artifacts/**/*.yml
artifacts/**/*.blockmap