-
-
Notifications
You must be signed in to change notification settings - Fork 44
123 lines (103 loc) · 4.98 KB
/
release.yml
File metadata and controls
123 lines (103 loc) · 4.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Release
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
permissions:
contents: write # Required to upload release assets
jobs:
build-linux-gnu:
name: release artifacts
strategy:
matrix:
extension_name:
- pg_jsonschema
package_name:
- pg-jsonschema
pgrx_version:
- 0.16.1
postgres: [14, 15, 16, 17, 18]
box:
- { runner: ubuntu-latest, arch: amd64 }
- { runner: ubuntu-24.04-arm, arch: arm64 }
runs-on: ${{ matrix.box.runner }}
timeout-minutes: 90
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- id: build
name: build release artifacts
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 gcc tree
# Install requested postgres version
sudo apt install -y postgresql-${{ matrix.postgres }} postgresql-server-dev-${{ matrix.postgres }} -y
# Ensure installed pg_config is first on path
export PATH=/usr/lib/postgresql/${{ matrix.postgres }}/bin:$PATH
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --default-toolchain stable && \
rustup --version && \
rustc --version && \
cargo --version
# Ensure cargo/rust on path
source "$HOME/.cargo/env"
cargo install cargo-pgrx --version ${{ matrix.pgrx_version }} --locked
cargo pgrx init --pg${{ matrix.postgres }}=/usr/lib/postgresql/${{ matrix.postgres }}/bin/pg_config
# selects the pgVer from pg_config on path
# https://github.com/tcdi/pgrx/issues/288
cargo pgrx package --no-default-features --features pg${{ matrix.postgres }}
# Create installable package
mkdir archive
cp `find target/release -type f -name "${{ matrix.extension_name }}*"` archive
# name of the package directory before packaging
package_dir=${{ matrix.extension_name }}-${{ github.ref_name }}-pg${{ matrix.postgres }}-${{ matrix.box.arch }}-linux-gnu
# Copy files into directory structure
extension_dir="${package_dir}$(pg_config --sharedir)/extension"
lib_dir="${package_dir}$(pg_config --pkglibdir)"
mkdir -p "$extension_dir" "$lib_dir"
cp archive/*.so "$lib_dir"
cp archive/*.control archive/*.sql "$extension_dir"
# Create install control file
extension_version="${{ github.ref_name }}"
# strip the leading v
deb_version=${extension_version:1}
mkdir -p ${package_dir}/DEBIAN
touch ${package_dir}/DEBIAN/control
echo 'Package: ${{ matrix.package_name }}-postgresql-${{ matrix.postgres }}' >> ${package_dir}/DEBIAN/control
echo 'Version:' ${deb_version} >> ${package_dir}/DEBIAN/control
echo 'Architecture: ${{ matrix.box.arch }}' >> ${package_dir}/DEBIAN/control
echo 'Maintainer: supabase' >> ${package_dir}/DEBIAN/control
echo 'Description: A PostgreSQL extension' >> ${package_dir}/DEBIAN/control
# Create deb package
sudo chown -R root:root ${package_dir}
sudo chmod -R 00755 ${package_dir}
sudo dpkg-deb --build --root-owner-group ${package_dir}
echo "artifact=${package_dir}.deb" >> "$GITHUB_OUTPUT"
- name: Upload release artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: ${{ steps.build.outputs.artifact }}
path: ${{ steps.build.outputs.artifact }}
if-no-files-found: error
release:
name: Create Release
needs: [build-linux-gnu]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download release artifacts
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
with:
generate_release_notes: true
draft: false
prerelease: false
files: pg_jsonschema*.deb