Skip to content

Commit 6b73d44

Browse files
committed
version-3.53.3
0 parents  commit 6b73d44

3 files changed

Lines changed: 197 additions & 0 deletions

File tree

‎.github/workflows/amalgamation.yml‎

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: amalgamation
2+
3+
on:
4+
push:
5+
tags:
6+
- "version-*"
7+
- "3.*"
8+
workflow_dispatch:
9+
inputs:
10+
sqlite_tag:
11+
description: "Upstream sqlite/sqlite tag to build (e.g. version-3.47.2). Defaults to the contents of SQLITE_TAG."
12+
required: false
13+
type: string
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
build:
20+
name: Build and release SQLite amalgamation
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Check out this repository
24+
uses: actions/checkout@v4
25+
26+
- name: Resolve SQLite tag
27+
id: resolve
28+
env:
29+
INPUT_TAG: ${{ inputs.sqlite_tag }}
30+
run: |
31+
set -euo pipefail
32+
TAG="${INPUT_TAG:-}"
33+
if [ -z "$TAG" ]; then
34+
if [ ! -f SQLITE_TAG ]; then
35+
echo "::error::SQLITE_TAG file not found in repository root"
36+
exit 1
37+
fi
38+
TAG="$(tr -d " \t\r\n" < SQLITE_TAG)"
39+
fi
40+
if [ -z "$TAG" ]; then
41+
echo "::error::No SQLite tag given (SQLITE_TAG file is empty)"
42+
exit 1
43+
fi
44+
# Accept both "version-3.53.3" and bare "3.53.3"
45+
case "$TAG" in
46+
version-*) ;;
47+
*) TAG="version-$TAG" ;;
48+
esac
49+
50+
if [ "${GITHUB_REF_TYPE:-}" = "tag" ]; then
51+
RELEASE_TAG="$GITHUB_REF_NAME"
52+
# Guard against tagging a release whose SQLITE_TAG file was not updated
53+
PUSHED="${RELEASE_TAG#version-}"
54+
WANT="${TAG#version-}"
55+
case "$PUSHED" in
56+
"$WANT"*) ;;
57+
*)
58+
echo "::error::Pushed tag '$RELEASE_TAG' does not match SQLITE_TAG file contents '$TAG'. Update SQLITE_TAG in the tagged commit, or push a matching tag."
59+
exit 1
60+
;;
61+
esac
62+
else
63+
RELEASE_TAG="$TAG"
64+
fi
65+
66+
echo "Building upstream tag: $TAG (release tag: $RELEASE_TAG)"
67+
{
68+
echo "sqlite_tag=$TAG"
69+
echo "release_tag=$RELEASE_TAG"
70+
} >> "$GITHUB_OUTPUT"
71+
72+
- name: Install build dependencies
73+
run: |
74+
sudo apt-get update
75+
sudo apt-get install -y --no-install-recommends tcl tcl-dev zip
76+
77+
- name: Fetch SQLite source at tag
78+
run: |
79+
git clone --depth 1 --branch "${{ steps.resolve.outputs.sqlite_tag }}" \
80+
-c advice.detachedHead=false \
81+
https://github.com/sqlite/sqlite.git sqlite-src
82+
83+
- name: Build amalgamation
84+
working-directory: sqlite-src
85+
run: |
86+
set -euo pipefail
87+
./configure
88+
make sqlite3.c
89+
# Old tags (pre-3.24) ship shell.c as a plain source file instead of a make target
90+
make shell.c || cp src/shell.c shell.c
91+
92+
- name: Package
93+
id: package
94+
run: |
95+
set -euo pipefail
96+
VERSION="$(tr -d " \t\r\n" < sqlite-src/VERSION)"
97+
IFS=. read -r MAJOR MINOR PATCH BRANCH <<< "$VERSION"
98+
# sqlite.org download naming: 3.X.Y -> 3XXYY00, 3.X.Y.Z -> 3XXYYZZ (e.g. 3.53.3 -> 3530300)
99+
NUM="$(printf '%d%02d%02d%02d' "$MAJOR" "$MINOR" "${PATCH:-0}" "${BRANCH:-0}")"
100+
DIR="sqlite-amalgamation-$NUM"
101+
102+
mkdir "$DIR"
103+
cp sqlite-src/sqlite3.c sqlite-src/sqlite3.h sqlite-src/shell.c "$DIR"/
104+
cp sqlite-src/src/sqlite3ext.h "$DIR"/
105+
zip -9 -r "$DIR.zip" "$DIR"
106+
107+
(cd "$DIR" && sha256sum sqlite3.c sqlite3.h shell.c sqlite3ext.h) > sha256sums.txt
108+
sha256sum "$DIR.zip" >> sha256sums.txt
109+
cat sha256sums.txt
110+
111+
SOURCE_ID="$(sed -n 's/^#define SQLITE_SOURCE_ID[[:space:]]*"\(.*\)".*/\1/p' "$DIR/sqlite3.h")"
112+
{
113+
echo "version=$VERSION"
114+
echo "dir=$DIR"
115+
echo "zip=$DIR.zip"
116+
echo "source_id=$SOURCE_ID"
117+
} >> "$GITHUB_OUTPUT"
118+
119+
- name: Create GitHub release
120+
env:
121+
GH_TOKEN: ${{ github.token }}
122+
RELEASE_TAG: ${{ steps.resolve.outputs.release_tag }}
123+
SQLITE_TAG: ${{ steps.resolve.outputs.sqlite_tag }}
124+
VERSION: ${{ steps.package.outputs.version }}
125+
DIR: ${{ steps.package.outputs.dir }}
126+
ZIP: ${{ steps.package.outputs.zip }}
127+
SOURCE_ID: ${{ steps.package.outputs.source_id }}
128+
run: |
129+
set -euo pipefail
130+
ASSETS=("$ZIP" "$DIR/sqlite3.c" "$DIR/sqlite3.h" "$DIR/shell.c" "$DIR/sqlite3ext.h" sha256sums.txt)
131+
132+
{
133+
echo "SQLite **$VERSION** amalgamation, built from [sqlite/sqlite tag \`$SQLITE_TAG\`](https://github.com/sqlite/sqlite/releases/tag/$SQLITE_TAG) with \`./configure && make sqlite3.c shell.c\` on ubuntu-latest."
134+
echo
135+
echo '```'
136+
echo "SQLITE_SOURCE_ID: $SOURCE_ID"
137+
echo '```'
138+
echo
139+
echo "\`$ZIP\` matches the sqlite.org download layout (sqlite3.c, sqlite3.h, shell.c, sqlite3ext.h); the same four files are also attached individually, plus \`sha256sums.txt\`."
140+
} > notes.md
141+
142+
if gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
143+
echo "Release $RELEASE_TAG already exists; replacing assets"
144+
gh release upload "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --clobber "${ASSETS[@]}"
145+
else
146+
gh release create "$RELEASE_TAG" \
147+
--repo "$GITHUB_REPOSITORY" \
148+
--target "$GITHUB_SHA" \
149+
--title "SQLite $VERSION amalgamation" \
150+
--notes-file notes.md \
151+
"${ASSETS[@]}"
152+
fi

‎README.md‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# SQLite amalgamation builds
2+
3+
[sqlite/sqlite](https://github.com/sqlite/sqlite) (the GitHub mirror of the canonical
4+
Fossil repository) has a tag for every release but publishes no amalgamation
5+
(`sqlite3.c` / `sqlite3.h`), and [sqlite.org/download.html](https://sqlite.org/download.html)
6+
only hosts the current versions — no historical files.
7+
8+
This repository builds the amalgamation for any upstream tag with GitHub Actions
9+
and publishes it as a release here.
10+
11+
## Cutting a release
12+
13+
1. Put the upstream tag into [`SQLITE_TAG`](SQLITE_TAG), e.g. `version-3.53.3`.
14+
2. Commit, tag the commit with the same name, and push both:
15+
16+
```sh
17+
git commit -am "SQLite 3.53.3"
18+
git tag version-3.53.3
19+
git push origin HEAD version-3.53.3
20+
```
21+
22+
The [`amalgamation`](.github/workflows/amalgamation.yml) workflow then clones
23+
`sqlite/sqlite` at that tag, runs `./configure && make sqlite3.c shell.c`, and
24+
creates a release for the pushed tag with these assets:
25+
26+
- `sqlite-amalgamation-<N>.zip` — same layout as the sqlite.org download
27+
(`sqlite3.c`, `sqlite3.h`, `shell.c`, `sqlite3ext.h`), with `<N>` encoded the
28+
same way (3.53.3 → `3530300`)
29+
- the same four files attached individually
30+
- `sha256sums.txt`
31+
32+
The workflow fails if the pushed tag does not match the contents of
33+
`SQLITE_TAG`, so a stale file can't produce a mislabeled release.
34+
35+
## Backfilling historical versions
36+
37+
To build an old version without making a commit, run the workflow manually
38+
(Actions → amalgamation → Run workflow) and enter the upstream tag, or:
39+
40+
```sh
41+
gh workflow run amalgamation -f sqlite_tag=version-3.47.2
42+
```
43+
44+
This creates the release (and its git tag in this repo) automatically.

‎SQLITE_TAG‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version-3.53.3

0 commit comments

Comments
 (0)