-
Notifications
You must be signed in to change notification settings - Fork 7
184 lines (156 loc) · 6.15 KB
/
Copy pathrelease.yml
File metadata and controls
184 lines (156 loc) · 6.15 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build-cli:
name: Build CLI ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: linux-x86_64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
name: linux-aarch64
- target: x86_64-apple-darwin
os: macos-13
name: darwin-x86_64
- target: aarch64-apple-darwin
os: macos-latest
name: darwin-aarch64
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Prepare artifact
run: |
cp target/${{ matrix.target }}/release/embedded-postgres embedded-postgres-${{ matrix.name }}
chmod +x embedded-postgres-${{ matrix.name }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: cli-${{ matrix.name }}
path: embedded-postgres-${{ matrix.name }}
build-postgres-bundle:
name: Bundle PostgreSQL ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-13
name: darwin-x86_64
pg_target: x86_64-apple-darwin
- os: macos-latest
name: darwin-aarch64
pg_target: aarch64-apple-darwin
- os: ubuntu-latest
name: linux-x86_64
pg_target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
name: linux-aarch64
pg_target: aarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- name: Load versions
id: versions
run: |
source versions.env
echo "PG_VERSION=$PG_VERSION" >> $GITHUB_OUTPUT
echo "PGVECTOR_VERSION=$PGVECTOR_VERSION" >> $GITHUB_OUTPUT
- name: Download PostgreSQL
run: |
mkdir -p bundle
PG_URL="https://github.com/theseus-rs/postgresql-binaries/releases/download/${{ steps.versions.outputs.PG_VERSION }}/postgresql-${{ steps.versions.outputs.PG_VERSION }}-${{ matrix.pg_target }}.tar.gz"
echo "Downloading PostgreSQL from $PG_URL"
curl -fsSL "$PG_URL" -o postgresql.tar.gz
tar -xzf postgresql.tar.gz -C bundle
rm postgresql.tar.gz
- name: Download pgvector
run: |
PG_VERSION="${{ steps.versions.outputs.PG_VERSION }}"
PGVECTOR_VERSION="${{ steps.versions.outputs.PGVECTOR_VERSION }}"
PG_MAJOR=$(echo "$PG_VERSION" | cut -d. -f1)
PGVECTOR_URL="https://github.com/pgvector/pgvector/releases/download/v${PGVECTOR_VERSION}/pgvector-v${PGVECTOR_VERSION}-pg${PG_MAJOR}-${{ matrix.pg_target }}.tar.gz"
echo "Downloading pgvector from $PGVECTOR_URL"
if curl -fsSL "$PGVECTOR_URL" -o pgvector.tar.gz 2>/dev/null; then
mkdir -p pgvector_extract
tar -xzf pgvector.tar.gz -C pgvector_extract
rm pgvector.tar.gz
# Find PostgreSQL directory in bundle
PG_DIR=$(find bundle -maxdepth 1 -type d | tail -1)
# Copy pgvector files
find pgvector_extract -name "*.so" -exec cp {} "$PG_DIR/lib/" \; 2>/dev/null || true
find pgvector_extract -name "*.dylib" -exec cp {} "$PG_DIR/lib/" \; 2>/dev/null || true
find pgvector_extract -name "vector.control" -exec cp {} "$PG_DIR/share/extension/" \; 2>/dev/null || true
find pgvector_extract -name "vector--*.sql" -exec cp {} "$PG_DIR/share/extension/" \; 2>/dev/null || true
rm -rf pgvector_extract
echo "pgvector installed"
else
echo "Warning: pgvector not available for this platform"
fi
- name: Create bundle archive
run: |
PG_VERSION="${{ steps.versions.outputs.PG_VERSION }}"
cd bundle
tar -czf ../postgresql-${PG_VERSION}-${{ matrix.pg_target }}.tar.gz .
cd ..
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: postgresql-${{ matrix.name }}
path: postgresql-${{ steps.versions.outputs.PG_VERSION }}-${{ matrix.pg_target }}.tar.gz
release:
needs: [build-cli, build-postgres-bundle]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Load versions
id: versions
run: |
source versions.env
echo "PG_VERSION=$PG_VERSION" >> $GITHUB_OUTPUT
echo "PGVECTOR_VERSION=$PGVECTOR_VERSION" >> $GITHUB_OUTPUT
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release files
run: |
mkdir release
find artifacts -type f -exec mv {} release/ \;
ls -la release/
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: release/*
generate_release_notes: true
body: |
## Embedded PostgreSQL CLI
### CLI Binaries
Download the CLI for your platform:
- `embedded-postgres-darwin-aarch64` - macOS Apple Silicon
- `embedded-postgres-darwin-x86_64` - macOS Intel
- `embedded-postgres-linux-x86_64` - Linux x86_64
- `embedded-postgres-linux-aarch64` - Linux ARM64
### PostgreSQL Bundles (with pgvector)
These are automatically downloaded by the CLI on first run:
- PostgreSQL ${{ steps.versions.outputs.PG_VERSION }} with pgvector ${{ steps.versions.outputs.PGVECTOR_VERSION }}
### Installation
```bash
curl -fsSL https://raw.githubusercontent.com/vectorize-io/embedded-pg-cli/main/install.sh | bash
```