-
Notifications
You must be signed in to change notification settings - Fork 3
140 lines (126 loc) · 4.67 KB
/
Copy pathrelease.yml
File metadata and controls
140 lines (126 loc) · 4.67 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
name: Release
permissions:
contents: write
packages: write
on:
push:
tags:
- 'v*'
jobs:
pre-clean:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Delete existing release by tag
uses: actions/github-script@v7
env:
TAG_NAME: ${{ github.ref_name }}
with:
script: |
const tag = process.env.TAG_NAME
const { owner, repo } = context.repo
try {
const release = await github.rest.repos.getReleaseByTag({ owner, repo, tag })
await github.rest.repos.deleteRelease({ owner, repo, release_id: release.data.id })
} catch (e) {
core.info(`skip delete: ${e.message}`)
}
build-and-release:
needs: pre-clean
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'npm'
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Install fpm (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y ruby ruby-dev rubygems build-essential
sudo gem install fpm
- name: Build webpack bundles
run: npm run build:github
env:
NODE_ENV: 'production'
- name: Verify build output
shell: bash
run: |
echo "Checking dist/electron directory..."
ls -la dist/electron/ 2>/dev/null || dir dist\\electron\\ || echo "Directory listing failed"
echo ""
echo "Checking for main.js..."
if [ -f "dist/electron/main.js" ]; then
SIZE=$(stat -f%z dist/electron/main.js 2>/dev/null || stat -c%s dist/electron/main.js 2>/dev/null || echo "unknown")
echo "✓ main.js found ($SIZE bytes)"
else
echo "✗ main.js not found"
echo "Contents of dist directory:"
find dist -type f 2>/dev/null || echo "find command failed"
exit 1
fi
echo ""
echo "Checking for index.js (renderer)..."
if [ -f "dist/electron/index.js" ]; then
SIZE=$(stat -f%z dist/electron/index.js 2>/dev/null || stat -c%s dist/electron/index.js 2>/dev/null || echo "unknown")
echo "✓ index.js found ($SIZE bytes)"
else
echo "✗ index.js not found"
echo "Contents of dist/electron directory:"
find dist/electron -type f 2>/dev/null || echo "find command failed"
exit 1
fi
echo ""
echo "✓ Build verification passed!"
- name: Build and publish with electron-builder
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
SKIP_NOTARIZE: 'true'
DEBUG: 'electron-builder'
run: |
echo "Starting electron-builder..."
npx electron-builder --publish onTagOrDraft 2>&1 | tee electron-builder.log
EXIT_CODE=${PIPESTATUS[0]}
if [ $EXIT_CODE -ne 0 ]; then
echo ""
echo "❌ electron-builder failed with exit code $EXIT_CODE"
echo ""
echo "Checking if app.asar was created..."
if [ -f "release/mac/LinkCore Download Manager.app/Contents/Resources/app.asar" ]; then
echo "app.asar exists, checking contents..."
npx asar list "release/mac/LinkCore Download Manager.app/Contents/Resources/app.asar" | head -50
elif [ -f "release/win-unpacked/resources/app.asar" ]; then
echo "app.asar exists (Windows), checking contents..."
npx asar list "release/win-unpacked/resources/app.asar" | head -50
elif [ -f "release/linux-unpacked/resources/app.asar" ]; then
echo "app.asar exists (Linux), checking contents..."
npx asar list "release/linux-unpacked/resources/app.asar" | head -50
else
echo "app.asar not found"
fi
echo ""
echo "Last 50 lines of output:"
tail -n 50 electron-builder.log
exit $EXIT_CODE
fi
shell: bash
- name: Upload build logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-logs-${{ matrix.os }}
path: |
electron-builder.log
*.log
retention-days: 7