Skip to content

Commit

Permalink
Generate META.json
Browse files Browse the repository at this point in the history
Rather than modify it in the repository and potentially create weird
conflicts. Generate it from an input file, instead. Use the new
`GIT_BUNDLE_OPTS` variable for the pgxn/pgxn-tools container to add the
generated `META.json` file to the bundle. It would otherwise be excluded
because `git archive` includes only committed files.
  • Loading branch information
theory committed Jan 22, 2024
1 parent 8e05943 commit 8588cf2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.gitignore export-ignore
.gitattributes export-ignore
.github export-ignore
*.bak export-ignore
META.json.in export-ignore
7 changes: 4 additions & 3 deletions .github/workflows/pgxn-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: ⚙️ Release on PGXN
on:
push:
# Release on semantic version tag.
tags: ['v[0-9]+.[0-9]+.[0-9]+']
# tags: ['v[0-9]+.[0-9]+.[0-9]+']
jobs:
release:
name: Release on PGXN
Expand All @@ -12,9 +12,10 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4
- name: Bundle the Release
run: make META.json.bak && pgxn-bundle
env: { GIT_BUNDLE_OPTS: --add-file META.json }
run: make META.json && pgxn-bundle
- name: Release on PGXN
env:
PGXN_USERNAME: ${{ secrets.PGXN_USERNAME }}
PGXN_PASSWORD: ${{ secrets.PGXN_PASSWORD }}
run: pgxn-release
run: ls -lah # pgxn-release
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ docker/**
*.deb
poetry.lock
site
*.bak
META.json
File renamed without changes.
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PGRX_POSTGRES ?= pg15
DISTNAME = $(shell grep -m 1 '^name' Cargo.toml | sed -e 's/[^"]*"\([^"]*\)",\{0,1\}/\1/')
DISTVERSION = $(shell grep -m 1 '^version' Cargo.toml | sed -e 's/[^"]*"\([^"]*\)",\{0,1\}/\1/')

test:
Expand All @@ -12,9 +13,13 @@ format:
run.postgres:
docker run -d --name pgmq-pg -e POSTGRES_PASSWORD=postgres -p 5432:5432 quay.io/tembo/pgmq-pg:latest

META.json.bak: Cargo.toml META.json
@sed -i.bak "s/@CARGO_VERSION@/$(DISTVERSION)/g" META.json
META.json: META.json.in Cargo.toml
@sed "s/@CARGO_VERSION@/$(DISTVERSION)/g" $< > $@

pgxn-zip: META.json.bak
git archive --format zip --prefix=pgmq-$(DISTVERSION)/ -o pgmq-$(DISTVERSION).zip HEAD
@mv META.json.bak META.json
$(DISTNAME)-$(DISTVERSION).zip: META.json
git archive --format zip --prefix $(DISTNAME)-$(DISTVERSION)/ --add-file $< -o $(DISTNAME)-$(DISTVERSION).zip HEAD

pgxn-zip: $(DISTNAME)-$(DISTVERSION).zip

clean:
@rm -rf META.json $(DISTNAME)-$(DISTVERSION).zip

0 comments on commit 8588cf2

Please sign in to comment.