Skip to content

feat: add PostgreSQL version agnostic installation #39

feat: add PostgreSQL version agnostic installation

feat: add PostgreSQL version agnostic installation #39

Workflow file for this run

name: Build and Release Package
on: [push]
env:
MAINTAINER_NAME: "Andriel Nuernberg"
MAINTAINER_EMAIL: "andrielfn@gmail.com"
GITHUB_USERNAME: "andrielfn"
VERSION: "0.0.1"
PG_VERSION: "16"
jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Build package
uses: ./.github/actions/build-deb
env:
MAINTAINER_NAME: ${{ env.MAINTAINER_NAME }}
MAINTAINER_EMAIL: ${{ env.MAINTAINER_EMAIL }}
GITHUB_USERNAME: ${{ env.GITHUB_USERNAME }}
VERSION: ${{ env.VERSION }}
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: postgresql-ulid-deb
path: ./*.deb
test:
name: Test
needs: build
runs-on: ubuntu-22.04
steps:
- name: Download package
uses: actions/download-artifact@v4
with:
name: postgresql-ulid-deb
- name: Install PostgreSQL
run: |
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
sudo apt-get update
sudo apt-get install -y postgresql-${{ env.PG_VERSION }} postgresql-contrib-${{ env.PG_VERSION }}
# - name: Start PostgreSQL service
# run: |
# sudo systemctl start postgresql
# sudo systemctl status postgresql
- name: Install package
run: |
sudo dpkg -i *.deb
sudo apt-get install -f
- name: Verify PostgreSQL and extension installation
run: |
psql --version
sudo dpkg -L postgresql-${{ env.PG_VERSION }}-ulid
ls -l /usr/share/postgresql/${{ env.PG_VERSION }}/extension/ | grep ulid
- name: Test PostgreSQL extension
run: |
sudo -u postgres psql -c "SHOW server_version;"
sudo -u postgres psql -c "SHOW data_directory;"
sudo -u postgres psql -c "CREATE EXTENSION ulid;"
sudo -u postgres psql -c "SELECT gen_ulid();"
sudo -u postgres psql -c "SELECT '01H55TNAQ96WPSWE6WZRCH9G0C'::ulid::timestamp;"
release:
name: Create Release
needs: [build, test]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Download package
uses: actions/download-artifact@v4
with:
name: postgresql-ulid-deb
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "postgresql-${{ env.PG_VERSION }}-ulid_${{ env.VERSION }}_amd64.deb"
name: Release ${{ github.sha }}
tag: ${{ github.sha }}
draft: false
prerelease: false