Skip to content

Commit 74e3b4c

Browse files
committed
build: add recipe to bundle a release
Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
1 parent cdf1851 commit 74e3b4c

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

.github/workflows/publish.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
name: Publish
22

3-
# The Docs workflow only runs on changes to SQL or control files and hence is a good indicator of whether to trigger a new release. Additionally, it ensures the docs are updated before publishing a new release.
43
on:
5-
workflow_run:
6-
workflows:
7-
- Docs
8-
types:
9-
- completed
4+
workflow_dispatch:
105

116
jobs:
127
dbdev:
@@ -16,6 +11,9 @@ jobs:
1611
- name: Checkout repository
1712
uses: actions/checkout@v4
1813

14+
- name: Prepare the release
15+
run: make bundle
16+
1917
- name: Install dbdev CLI
2018
run: |
2119
curl -fsSL $(curl -s https://api.github.com/repos/supabase/dbdev/releases/latest | grep "browser_download_url.*linux-amd64\.deb" | cut -d '"' -f 4) -o dbdev.deb
@@ -46,7 +44,10 @@ jobs:
4644
- name: Checkout repository
4745
uses: actions/checkout@v4
4846

49-
- name: Bundle the Release
47+
- name: Prepare the release
48+
run: make prepare
49+
50+
- name: Bundle the release
5051
run: pgxn-bundle
5152

5253
- name: Publish to PGXN
@@ -86,6 +87,10 @@ jobs:
8687
echo "should_release=true" >> $GITHUB_OUTPUT
8788
fi
8889
90+
- name: Bundle the release
91+
if: ${{ steps.version_check.outputs.should_release == 'true' }}
92+
run: make dist
93+
8994
- name: Generate changelog
9095
id: changelog
9196
if: ${{ steps.version_check.outputs.should_release == 'true' }}
@@ -155,4 +160,5 @@ jobs:
155160
- [PGXN](https://pgxn.org/dist/pg_dispatch)
156161
157162
## Changes
158-
${{ steps.changelog.outputs.changelog }}
163+
${{ steps.changelog.outputs.changelog }}
164+
files: dist/pg_dispatch-${{ steps.version.outputs.version }}.zip

Makefile

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
EXTENSION = pg_dispatch
2-
EXTVERSION = 0.1.3
3-
DATA = pg_dispatch--0.1.3.sql
2+
EXTVERSION = $(shell grep default_version $(EXTENSION).control | sed "s/default_version = '\(.*\)'/\1/")
3+
DATA = $(EXTENSION)--$(EXTVERSION).sql
44

55
PG_CONFIG ?= pg_config
66
PGXS := $(shell $(PG_CONFIG) --pgxs)
77
include $(PGXS)
88

9-
.PHONY: dist docs
9+
.PHONY: prepare dist docs test
10+
prepare:
11+
cp pg_dispatch.sql $(EXTENSION)--$(EXTVERSION).sql
12+
sed 's/@VERSION@/$(EXTVERSION)/g' META.json.in > META.json
13+
1014
dist:
15+
make prepare
1116
mkdir -p dist
1217
git archive --format zip --prefix=$(EXTENSION)-$(EXTVERSION)/ -o dist/$(EXTENSION)-$(EXTVERSION).zip HEAD
1318

19+
clean:
20+
rm -rf dist/
21+
rm -f META.json
22+
rm -f $(EXTENSION)--*.sql
23+
1424
docs:
15-
bash scripts/update-docs.sh
25+
bash scripts/update-docs.sh
26+
27+
test:
28+
bash scripts/test.sh

0 commit comments

Comments
 (0)