Skip to content

trying ot fix

trying ot fix #7

Workflow file for this run

env:
NAME: pgrx-uids_postgres
EXT_NAME: uids
PKG_NAME: pg-uids_postgres
name: Release
on:
push:
tags: [v*]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
create-release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
build-linux-gnu:
name: Build & Release for linux
needs: create-release
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
uses: dtolnay/[email protected]
- name: Install dependencies
run: |
# Add postgres package repo
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null
sudo apt-get update
sudo apt-get install -y --no-install-recommends git build-essential libpq-dev curl libreadline6-dev zlib1g-dev pkg-config cmake
sudo apt-get install -y --no-install-recommends libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache
sudo apt-get install -y --no-install-recommends clang libclang-dev llvm-dev gcc tree
# Install PostgreSQL v16
sudo apt-get install -y postgresql-16 postgresql-server-dev-16 -y
# Ensure installed pg_config is first on path
export PATH=$PATH:/usr/lib/postgresql/16/bin
cargo install cargo-pgrx --version 0.11.4 --locked
cargo pgrx init --pg16=/usr/lib/postgresql/16/bin/pg_config
- name: Build artifacts
run: |
# selects the pgVer from pg_config on path
cargo pgrx package --no-default-features --features pg16
# Create installable package
mkdir archive
cp `find target/release -type f -name "${{ env.EXT_NAME }}*"` archive
# Copy files into directory structure
mkdir -p package/usr/lib/postgresql/lib
mkdir -p package/var/lib/postgresql/extension
cp archive/*.so package/usr/lib/postgresql/lib
cp archive/*.control package/var/lib/postgresql/extension
cp archive/*.sql package/var/lib/postgresql/extension
# symlinks to Copy files into directory structure
mkdir -p package/usr/lib/postgresql/16/lib
cd package/usr/lib/postgresql/16/lib
cp -s ../../lib/*.so .
cd ../../../../../..
mkdir -p package/usr/share/postgresql/16/extension
cd package/usr/share/postgresql/16/extension
cp -s ../../../../../var/lib/postgresql/extension/${{ env.EXT_NAME }}.control .
cp -s ../../../../../var/lib/postgresql/extension/${{ env.EXT_NAME }}*.sql .
cd ../../../../../..
# Create install control file
extension_version=${{ github.ref_name }}
# strip the leading v
deb_version=${extension_version:1}
mkdir -p package/DEBIAN
touch package/DEBIAN/control
echo 'Package: ${{ env.PKG_NAME }}' >> package/DEBIAN/control
echo 'Version:' ${deb_version} >> package/DEBIAN/control
echo 'Architecture: amd64' >> package/DEBIAN/control
echo 'Maintainer: Spark' >> package/DEBIAN/control
echo 'Description: A PostgreSQL extension for Various IDS' >> package/DEBIAN/control
# Create deb package
sudo chown -R root:root package
sudo chmod -R 00755 package
sudo dpkg-deb -Zxz --build --root-owner-group package
- name: Upload artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./package.deb
asset_name: ${{ env.NAME }}-${{ github.ref_name }}-pg16-amd64-linux-gnu.deb
asset_content_type: application/vnd.debian.binary-package