-
Notifications
You must be signed in to change notification settings - Fork 22
182 lines (156 loc) · 6.91 KB
/
Copy pathupdate-better-sqlite3.yml
File metadata and controls
182 lines (156 loc) · 6.91 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
173
174
175
176
177
178
179
180
181
182
name: Update Better-SQLite3 Binaries
on:
schedule:
# Run daily at 7 AM UTC
- cron: '0 7 * * *'
workflow_dispatch:
inputs:
force_update:
description: 'Force update even if binaries exist'
required: false
default: 'false'
type: boolean
version:
description: 'Specific version to fetch (e.g., v12.4.1). Leave empty for latest.'
required: false
default: ''
type: string
jobs:
update-binaries:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
actions: write
env:
DBCODE_SUPPORTED_NODE_MAJORS: "20"
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Get latest release info
id: release
run: |
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
else
VERSION=$(curl -s https://api.github.com/repos/m4heshd/better-sqlite3-multiple-ciphers/releases/latest | jq -r '.tag_name')
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Fetching better-sqlite3-multiple-ciphers $VERSION"
- name: Download and process prebuilds
id: download
run: |
VERSION="${{ steps.release.outputs.version }}"
PACKAGES_DIR="packages/better-sqlite3"
TEMP_DIR="/tmp/prebuilds"
mkdir -p "$TEMP_DIR"
mkdir -p "$PACKAGES_DIR"
# Get all prebuild assets from the release
ASSETS=$(curl -s "https://api.github.com/repos/m4heshd/better-sqlite3-multiple-ciphers/releases/tags/$VERSION" | jq -r '.assets[] | select(.name | endswith(".tar.gz")) | .browser_download_url')
if [ -z "$ASSETS" ]; then
echo "No prebuilds found for $VERSION"
echo "has_updates=false" >> $GITHUB_OUTPUT
exit 0
fi
NEW_ELECTRON=""
NEW_CODESERVER=""
for url in $ASSETS; do
filename=$(basename "$url")
# Check if this is an electron prebuild (keep it)
if [[ "$filename" == *"-electron-"* ]]; then
target_file="$PACKAGES_DIR/$filename"
if [ -f "$target_file" ] && [ "${{ inputs.force_update }}" != "true" ]; then
echo "Already have $filename, skipping"
continue
fi
echo "Downloading $filename..."
curl -sL "$url" -o "$target_file"
NEW_ELECTRON="$NEW_ELECTRON
- $filename"
# Mirror every node prebuild as electron-* so any VS Code server Node
# version (WSL, SSH, dev containers, Codespaces, code-server) is covered.
elif [[ "$filename" == *"-node-v"* ]]; then
electron_filename="${filename/-node-v/-electron-v}"
target_file="$PACKAGES_DIR/$electron_filename"
if [ -f "$target_file" ] && [ "${{ inputs.force_update }}" != "true" ]; then
echo "Already have $electron_filename, skipping"
continue
fi
echo "Downloading $filename -> $electron_filename (for code-server)"
curl -sL "$url" -o "$target_file"
NEW_CODESERVER="$NEW_CODESERVER
- $electron_filename"
fi
done
# Write outputs
if [ -n "$NEW_ELECTRON" ] || [ -n "$NEW_CODESERVER" ]; then
echo "has_updates=true" >> $GITHUB_OUTPUT
else
echo "has_updates=false" >> $GITHUB_OUTPUT
fi
# Use heredoc for multiline output
{
echo "new_electron<<EOF"
echo "$NEW_ELECTRON"
echo "EOF"
} >> $GITHUB_OUTPUT
{
echo "new_codeserver<<EOF"
echo "$NEW_CODESERVER"
echo "EOF"
} >> $GITHUB_OUTPUT
- name: Self-build dropped Node ABIs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.release.outputs.version }}"
PACKAGES_DIR="packages/better-sqlite3"
declare -A ABI=( [20]=115 )
PLATFORMS=( "linux-x64" "linux-arm64" "linuxmusl-x64" "linuxmusl-arm64" "darwin-x64" "darwin-arm64" "win32-x64" )
for major in $DBCODE_SUPPORTED_NODE_MAJORS; do
abi="${ABI[$major]:-}"
if [ -z "$abi" ]; then echo "no ABI mapping for Node $major, skipping"; continue; fi
missing=0
for pa in "${PLATFORMS[@]}"; do
f="$PACKAGES_DIR/better-sqlite3-multiple-ciphers-$VERSION-electron-v$abi-$pa.tar.gz"
if [ ! -f "$f" ]; then missing=1; echo "missing $(basename "$f")"; fi
done
if [ "$missing" -eq 1 ]; then
echo "Dispatching self-build for $VERSION node $major"
gh workflow run build-better-sqlite3-node.yml -f version="${VERSION#v}" -f node="$major" || echo "dispatch failed (workflow may not be on default branch yet)"
fi
done
- name: Create Pull Request
if: steps.download.outputs.has_updates == 'true'
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update better-sqlite3-multiple-ciphers to ${{ steps.release.outputs.version }}"
title: "Update better-sqlite3-multiple-ciphers to ${{ steps.release.outputs.version }}"
body: |
This PR updates better-sqlite3-multiple-ciphers prebuilds.
**Version:** ${{ steps.release.outputs.version }}
**Electron prebuilds from upstream:**
${{ steps.download.outputs.new_electron }}
**Node prebuilds renamed for code-server:**
${{ steps.download.outputs.new_codeserver }}
These prebuilds are from [m4heshd/better-sqlite3-multiple-ciphers](https://github.com/m4heshd/better-sqlite3-multiple-ciphers/releases).
---
*This PR was automatically generated by the update-better-sqlite3 workflow.*
branch: update-better-sqlite3
delete-branch: true
- name: Summary
run: |
echo "## Better-SQLite3 Update Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** ${{ steps.release.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ steps.download.outputs.has_updates }}" == "true" ]; then
echo "**Electron prebuilds:**" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.download.outputs.new_electron }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Code-server prebuilds:**" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.download.outputs.new_codeserver }}" >> $GITHUB_STEP_SUMMARY
else
echo "No new binaries were needed." >> $GITHUB_STEP_SUMMARY
fi