Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 36 additions & 14 deletions .github/workflows/package-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
- 'sql/**'

permissions:
contents: write
contents: read

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -57,6 +57,19 @@ jobs:
with:
ref: ${{ github.event.inputs.tag || github.ref }}

# Release tooling (scripts, packaging helpers) must come from the commit
# that defines this workflow, not from the target tag. For
# workflow_dispatch, GitHub runs the workflow YAML from the default
# branch HEAD while the primary checkout above is pinned to an older
# tag, so the tag may predate these scripts. github.sha tracks the
# workflow's own commit for both workflow_dispatch (main HEAD) and
# push:tags (the tagged commit), keeping YAML and scripts in sync.
- name: Checkout release tooling
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
path: _release_tooling

- name: Set version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
Expand Down Expand Up @@ -100,8 +113,7 @@ jobs:
libxml2-dev \
libxslt1-dev \
libicu-dev \
file \
zip
file

install -d -m 0755 /usr/share/keyrings
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
Expand All @@ -128,7 +140,7 @@ jobs:
--no-default-features \
--features "$FEATURES"

scripts/package-deb.sh \
_release_tooling/scripts/package-deb.sh \
"$VERSION" \
"$PWD/target/release/pg_durable-pg${{ matrix.pg_version }}" \
"${{ matrix.platform.type }}" \
Expand All @@ -148,19 +160,12 @@ jobs:
dpkg-deb -x "$deb_file" check-package
file "check-package/usr/lib/postgresql/${{ matrix.pg_version }}/lib/pg_durable.so" | grep -E "${{ matrix.platform.file_pattern }}"

- name: Create package archive
run: |
cd dist
zip "pg-durable-${VERSION}-pg${{ matrix.pg_version }}-${{ matrix.platform.type }}.zip" \
pg-durable-postgresql-${{ matrix.pg_version }}_*_${{ matrix.platform.type }}.deb

- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: pg-durable-package-${{ github.run_id }}-pg${{ matrix.pg_version }}-${{ matrix.platform.type }}
path: |
dist/*.deb
dist/*.zip
retention-days: 30

validate-packages:
Expand All @@ -180,6 +185,15 @@ jobs:
with:
ref: ${{ github.event.inputs.tag || github.ref }}

# See build-packages: validation tooling must come from the workflow's
# own commit (github.sha), not the target tag, so a tag predating these
# scripts still validates correctly.
- name: Checkout release tooling
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
path: _release_tooling

- name: Download package artifact
uses: actions/download-artifact@v4
with:
Expand All @@ -194,7 +208,7 @@ jobs:
-w /work \
--user root \
debian:bookworm \
bash -euxo pipefail -c 'scripts/validate-deb-package.sh "${{ matrix.pg_version }}" "${{ matrix.platform.type }}"'
bash -euxo pipefail -c '_release_tooling/scripts/validate-deb-package.sh "${{ matrix.pg_version }}" "${{ matrix.platform.type }}"'

- name: Upload validation diagnostics on failure
if: failure()
Expand Down Expand Up @@ -248,6 +262,8 @@ jobs:
needs: [validate-packages, build-source]
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.inputs.publish_release == 'true'
permissions:
contents: write

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -278,5 +294,11 @@ jobs:
--draft
fi

find artifacts -type f \( -name '*.zip' -o -name '*.tar.gz' -o -name '*.tar.bz2' \) -print0 \
| xargs -0 -I {} gh release upload "$VERSION" "{}" --clobber
mkdir -p release-assets
find artifacts -type f \( -name '*.deb' -o -name '*.tar.gz' -o -name '*.tar.bz2' \) \
-exec cp -t release-assets {} +

( cd release-assets && sha256sum -- * > SHA256SUMS )

find release-assets -type f -print0 \
| xargs -0 -I {} gh release upload "$VERSION" "{}" --clobber
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ CREATE EXTENSION pg_durable;

The default pg_durable database is `postgres`; see [User Guide](USER_GUIDE.md) for background worker configuration and privilege setup.

Release assets also include source archives for building from source.
Each release also publishes source archives for building from source and a `SHA256SUMS` file for verifying downloaded assets.

## Development Installation

Expand Down
3 changes: 0 additions & 3 deletions scripts/package-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ case "$ARCH" in
amd64|x86_64)
DEB_ARCH="amd64"
;;
arm64|aarch64)
DEB_ARCH="arm64"
;;
*)
echo "unsupported architecture: $ARCH" >&2
exit 2
Expand Down
3 changes: 0 additions & 3 deletions scripts/validate-deb-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ case "$ARCH" in
amd64|x86_64)
DEB_ARCH="amd64"
;;
arm64|aarch64)
DEB_ARCH="arm64"
;;
*)
echo "unsupported architecture: $ARCH" >&2
exit 2
Expand Down
Loading