-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (98 loc) · 3.3 KB
/
Copy pathbuild.yml
File metadata and controls
113 lines (98 loc) · 3.3 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
name: Build
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
package:
name: Package on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- windows-latest
- macos-latest
- ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Run checks
run: npm run check
- name: Package app
run: npm run package
- name: Create Windows ZIP
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force release | Out-Null
$packageDir = Get-ChildItem -Path out -Directory | Select-Object -First 1
if (-not $packageDir) {
throw 'No packaged app directory found in out/.'
}
Compress-Archive -Path (Join-Path $packageDir.FullName '*') -DestinationPath release/easyeda2kicad-gui-windows-x64.zip -Force
- name: Create macOS ZIP
if: runner.os == 'macOS'
shell: bash
run: |
set -euo pipefail
mkdir -p release
package_dir="$(find out -maxdepth 1 -mindepth 1 -type d | head -n 1)"
app_bundle="$(find "$package_dir" -maxdepth 1 -name '*.app' -type d | head -n 1)"
if [ -z "$app_bundle" ]; then
echo "No .app bundle found in $package_dir" >&2
exit 1
fi
ditto -c -k --sequesterRsrc --keepParent "$app_bundle" release/easyeda2kicad-gui-macos-x64.zip
- name: Create Linux ZIP
if: runner.os == 'Linux'
shell: bash
run: |
set -euo pipefail
mkdir -p release
package_dir="$(find out -maxdepth 1 -mindepth 1 -type d | head -n 1)"
if [ -z "$package_dir" ]; then
echo "No packaged app directory found in out/." >&2
exit 1
fi
(cd "$package_dir" && zip -r "../../release/easyeda2kicad-gui-linux-x64.zip" .)
- name: Upload packaged ZIP
uses: actions/upload-artifact@v6
with:
name: easyeda2kicad-gui-${{ runner.os }}-x64
path: release/*.zip
if-no-files-found: error
release:
name: Publish GitHub Release
needs: package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
steps:
- name: Download packaged ZIPs
uses: actions/download-artifact@v7
with:
path: release-assets
merge-multiple: true
- name: Publish release assets
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
ls -la release-assets
if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release upload "$GITHUB_REF_NAME" release-assets/*.zip --repo "$GITHUB_REPOSITORY" --clobber
else
gh release create "$GITHUB_REF_NAME" release-assets/*.zip --repo "$GITHUB_REPOSITORY" --title "EasyEDA2KiCad GUI $GITHUB_REF_NAME" --generate-notes
fi