Skip to content

Commit a033416

Browse files
authored
chore: add deb/rpm (#62)
1 parent 7fe3a43 commit a033416

1 file changed

Lines changed: 83 additions & 1 deletion

File tree

‎.github/workflows/release.yml‎

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,89 @@ jobs:
8383
name: pgschema-${{ matrix.target }}
8484
path: pgschema-${{ matrix.target }}
8585

86-
release:
86+
packages:
8787
needs: build
8888
runs-on: ubuntu-latest
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@v4
92+
93+
- name: Read version
94+
id: version
95+
run: echo "version=$(cat internal/version/VERSION)" >> $GITHUB_OUTPUT
96+
97+
- name: Download Linux AMD64 binary
98+
uses: actions/download-artifact@v4
99+
with:
100+
name: pgschema-linux-amd64
101+
path: ./dist
102+
103+
- name: Install nfpm
104+
run: |
105+
echo "deb [trusted=yes] https://repo.goreleaser.com/apt/ /" | sudo tee /etc/apt/sources.list.d/goreleaser.list
106+
sudo apt-get update
107+
sudo apt-get install -y nfpm
108+
109+
- name: Prepare binary
110+
run: |
111+
chmod +x ./dist/pgschema-linux-amd64
112+
mkdir -p ./package/usr/bin
113+
cp ./dist/pgschema-linux-amd64 ./package/usr/bin/pgschema
114+
mkdir -p ./package/usr/share/doc/pgschema
115+
cp LICENSE ./package/usr/share/doc/pgschema/
116+
117+
- name: Create nfpm config
118+
run: |
119+
cat > nfpm.yaml <<EOF
120+
name: pgschema
121+
arch: amd64
122+
platform: linux
123+
version: ${{ steps.version.outputs.version }}
124+
section: database
125+
priority: optional
126+
maintainer: Bytebase <support@bytebase.com>
127+
description: |
128+
PostgreSQL declarative schema migration tool.
129+
Think of it as Terraform for your Postgres schemas - declare your desired state,
130+
generate plan, preview changes, and apply them with confidence.
131+
vendor: Bytebase
132+
homepage: https://www.pgschema.com
133+
license: Apache-2.0
134+
contents:
135+
- src: ./package/usr/bin/pgschema
136+
dst: /usr/bin/pgschema
137+
file_info:
138+
mode: 0755
139+
- src: ./package/usr/share/doc/pgschema/LICENSE
140+
dst: /usr/share/doc/pgschema/LICENSE
141+
file_info:
142+
mode: 0644
143+
rpm:
144+
group: Applications/Databases
145+
summary: PostgreSQL declarative schema migration tool
146+
EOF
147+
148+
- name: Build DEB package
149+
run: nfpm package --packager deb --target ./dist/
150+
151+
- name: Build RPM package
152+
run: nfpm package --packager rpm --target ./dist/
153+
154+
- name: Upload DEB package
155+
uses: actions/upload-artifact@v4
156+
with:
157+
name: pgschema-deb
158+
path: ./dist/*.deb
159+
160+
- name: Upload RPM package
161+
uses: actions/upload-artifact@v4
162+
with:
163+
name: pgschema-rpm
164+
path: ./dist/*.rpm
165+
166+
release:
167+
needs: [build, packages]
168+
runs-on: ubuntu-latest
89169
steps:
90170
- name: Checkout
91171
uses: actions/checkout@v4
@@ -111,6 +191,8 @@ jobs:
111191
binaries/pgschema-linux-arm64/pgschema-linux-arm64
112192
binaries/pgschema-darwin-amd64/pgschema-darwin-amd64
113193
binaries/pgschema-darwin-arm64/pgschema-darwin-arm64
194+
binaries/pgschema-deb/*.deb
195+
binaries/pgschema-rpm/*.rpm
114196
115197
docker:
116198
needs: release

0 commit comments

Comments
 (0)