Skip to content

Commit f7c6aff

Browse files
ci(sql): attach the SQL files to a release for each sql-v tag
1 parent 35a7c61 commit f7c6aff

3 files changed

Lines changed: 41 additions & 0 deletions

File tree

‎.github/workflows/release-sql.yml‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release SQL files
2+
3+
# Push a tag such as sql-v1.0.0. Nothing is published to a registry: the two files are
4+
# attached to a GitHub release, so that a database can be loaded from a pinned copy.
5+
on:
6+
push:
7+
tags: ["sql-v*"]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
steps:
18+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19+
with:
20+
fetch-depth: 0
21+
- name: Tag is on main
22+
run: git merge-base --is-ancestor "$GITHUB_SHA" origin/main
23+
- name: Tag matches the version in both files
24+
run: |
25+
for file in sql/postgres.sql sql/duckdb.sql; do
26+
test "sql-v$(sed -n 's/^-- Version //p' "$file")" = "$GITHUB_REF_NAME"
27+
done
28+
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
29+
- name: Both files agree with spec/vectors.json
30+
run: |
31+
sudo systemctl start postgresql.service
32+
sudo -u postgres createuser --superuser "$USER"
33+
PGDATABASE=postgres python3 scripts/sql_conformance.py postgres
34+
uv run --no-project --with duckdb==1.5.5 python scripts/sql_conformance.py duckdb
35+
- run: gh release create "$GITHUB_REF_NAME" sql/postgres.sql sql/duckdb.sql --title "SQL files ${GITHUB_REF_NAME#sql-v}" --generate-notes
36+
env:
37+
GH_TOKEN: ${{ github.token }}

‎docs/llms-full.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,8 @@ psql -f sql/postgres.sql # PostgreSQL, tested on 14 and 17
923923
duckdb my.db < sql/duckdb.sql # DuckDB, tested on 1.5
924924
```
925925

926+
Each numbered version of the two files is attached to a [GitHub release](https://github.com/Adeniyikayodee/ng-postcode/releases) tagged `sql-v`, so you can pin the copy you load.
927+
926928
## Store and check
927929

928930
```sql

‎sql/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ psql -f sql/postgres.sql # PostgreSQL, tested on 14 and 17
77
duckdb my.db < sql/duckdb.sql # DuckDB, tested on 1.5
88
```
99

10+
Each numbered version of the two files is attached to a [GitHub release](https://github.com/Adeniyikayodee/ng-postcode/releases) tagged `sql-v`, so you can pin the copy you load.
11+
1012
## Store and check
1113

1214
```sql

0 commit comments

Comments
 (0)