-
Notifications
You must be signed in to change notification settings - Fork 10
129 lines (126 loc) Β· 5.07 KB
/
release.yml
File metadata and controls
129 lines (126 loc) Β· 5.07 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
# Need to write to repo contents to upload the app to GitHub Release
# See: https://www.electronforge.io/config/publishers/github#authentication
permissions:
contents: write
name: Release app
on:
workflow_dispatch:
push:
branches: [v0.1.0, release/**]
jobs:
build:
environment: release
permissions:
contents: write
strategy:
# Uncomment max-parallel to prevent race condition (where multiple releases are
# created concurrently). Typically though, we'll create a release manually ahead of time
# which prevents the race.
# max-parallel: 1
matrix:
# See https://github.com/SFARPak/dyad/issues/96
os:
[
{ name: "windows", image: "windows-latest" },
{ name: "linux", image: "ubuntu-22.04" },
{ name: "macos-intel", image: "macos-13" },
{ name: "macos", image: "macos-latest" },
]
runs-on: ${{ matrix.os.image }}
steps:
- name: Github checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Use Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
node-version: 20
- name: Clean up
run: |
rm -rf node_modules
npm cache clean --force
shell: bash
- run: npm ci --include=optional || npm install --include=optional
- run: npm rebuild @rollup/rollup-linux-x64-gnu || true
if: contains(matrix.os.name, 'linux')
- run: npm rebuild @rollup/rollup-darwin-x64 || true
if: contains(matrix.os.name, 'macos-intel')
- run: npm rebuild @rollup/rollup-darwin-arm64 || true
if: contains(matrix.os.name, 'macos')
- run: npm rebuild @rollup/rollup-win32-x64-msvc || true
if: contains(matrix.os.name, 'windows')
# Publish (all platforms)
- name: Publish app
env:
NODE_OPTIONS: "--max-old-space-size=4096"
SM_CODE_SIGNING_CERT_SHA1_HASH: ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
run: |
set -e
echo "=== Running publish (npm run publish) ==="
DEBUG=electron-forge:* npm run publish 2>&1 | tee publish.log
shell: bash
- name: Wait for GitHub to register release uploads
# Some publishers upload files asynchronously; wait and then list assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
VERSION=$(node -e "console.log(require('./package.json').version)")
TAG="v${VERSION}"
echo "Waiting for GitHub to register release ${TAG} assets..."
# Poll releases/tags endpoint for up to 90s (9 attempts)
attempts=0
max=9
sleep_interval=10
while [ $attempts -lt $max ]; do
echo "Attempt $((attempts+1))/${max}..."
# Use the tag endpoint to retrieve the release by tag
resp=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/${{ github.repository }}/releases/tags/${TAG}" || true)
if echo "$resp" | grep -q "\"message\": \"Not Found\""; then
echo "Release ${TAG} not found yet."
else
echo "Release found; printing release summary:"
echo "$resp" | jq -r '. | {name: .name, tag_name: .tag_name, draft: .draft, published_at: .published_at, html_url: .html_url, assets_count: .assets | length}'
echo "Assets list (name | size | url):"
echo "$resp" | jq -r '.assets[] | "\(.name) | \(.size) | \(.browser_download_url)"' || true
assets_count=$(echo "$resp" | jq '.assets | length')
if [ "$assets_count" -gt 0 ]; then
echo "Assets are present (count=$assets_count)"
break
else
echo "No assets yet; will retry."
fi
fi
attempts=$((attempts+1))
sleep $sleep_interval
done
if [ $attempts -eq $max ]; then
echo "Warning: Assets did not appear within the expected time. The verify job may fail."
fi
shell: bash
verify-assets:
name: Verify Release Assets
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
actions: read
id-token: write
steps:
- name: Github checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Use Node.js
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
with:
node-version: 20
- name: Verify all release assets are uploaded
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Running release asset verification..."
node scripts/verify-release-assets.js
shell: bash