Skip to content

Commit ebd276e

Browse files
authored
ci: bump release version (#186)
* ci: bump release version [skip ci] Signed-off-by: usamoi <usamoi@outlook.com> * ci: bot git name and email [skip ci] Signed-off-by: usamoi <usamoi@outlook.com> --------- Signed-off-by: usamoi <usamoi@outlook.com>
1 parent cc1b7d0 commit ebd276e

File tree

3 files changed

+88
-85
lines changed

3 files changed

+88
-85
lines changed

.github/workflows/nightly.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Nightly
2+
3+
on:
4+
schedule:
5+
# 00:00 UTC+8 -> 16:00
6+
- cron: "0 16 * * *"
7+
workflow_dispatch:
8+
9+
permissions:
10+
actions: write
11+
12+
jobs:
13+
setup:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
- run: |
19+
commit_date=$(git log -1 --since="24 hours ago" --pretty=format:"%cI")
20+
if [[ -n "$commit_date" ]]; then
21+
TZ='Asia/Shanghai' gh workflow run release.yml \
22+
-f version=$(date +"0.0.0-nightly.%Y%m%d") \
23+
-f prerelease=true
24+
fi
25+
env:
26+
GH_TOKEN: ${{ github.token }}

.github/workflows/release.yml

Lines changed: 53 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
name: Release
22

33
on:
4-
schedule:
5-
# 00:00 UTC+8 -> 16:00
6-
- cron: "0 16 * * *"
74
workflow_dispatch:
85
inputs:
96
version:
107
type: string
11-
description: The version to be released.
8+
description: Version
129
required: true
1310
prerelease:
1411
type: boolean
15-
description: Prerelease or not.
12+
description: Prerelease
1613
required: true
17-
default: true
14+
default: false
1815

1916
permissions:
2017
contents: write
@@ -26,81 +23,52 @@ env:
2623
RUSTC_WRAPPER: sccache
2724

2825
jobs:
29-
setup:
26+
release:
3027
runs-on: ubuntu-20.04
3128
steps:
3229
- name: Checkout
3330
uses: actions/checkout@v3
34-
- id: check-nightly
35-
run: |
36-
commit_date=$(git log -1 --since="24 hours ago" --pretty=format:"%cI")
37-
if [[ -n "$commit_date" ]];
38-
then echo "nightly=true" >> $GITHUB_OUTPUT;
39-
else echo "nightly=false" >> $GITHUB_OUTPUT;
40-
fi
41-
- name: Variables
42-
id: variables
43-
uses: actions/github-script@v6
31+
- uses: actions/github-script@v7
4432
with:
4533
script: |
46-
if ("${{ github.event_name }}" == 'schedule') {
47-
let date = new Date();
48-
date.setHours(date.getHours() + 8);
49-
var yyyy = date.getUTCFullYear();
50-
var mm = String(1 + date.getUTCMonth()).padStart(2, '0');
51-
var dd = String(0 + date.getUTCDate()).padStart(2, '0');
52-
let version = `v0.0.0-nightly.${yyyy}${mm}${dd}`;
53-
core.setOutput('version', version);
54-
if ("${{ steps.check-nightly.outputs.nightly }}" == "true") {
55-
core.setOutput('recheck', 'true');
56-
} else {
57-
core.setOutput('recheck', 'false');
58-
}
59-
core.setOutput('prerelease', true);
60-
}
61-
if ("${{ github.event_name }}" == 'workflow_dispatch') {
62-
let version = "${{ github.event.inputs.version }}";
63-
let prerelease = "${{ github.event.inputs.prerelease }}";
64-
core.setOutput('version', version);
65-
core.setOutput('recheck', 'true');
66-
core.setOutput('prerelease', prerelease);
34+
const r = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?/;
35+
if (!r.test("${{ github.event.inputs.version }}")) {
36+
core.setFailed(`Action failed with an invalid semver.`);
6737
}
68-
outputs:
69-
version: ${{ steps.variables.outputs.version }}
70-
recheck: ${{ steps.variables.outputs.recheck }}
71-
prerelease: ${{ steps.variables.outputs.prerelease }}
72-
create_github_release:
73-
needs: ["setup"]
74-
if: ${{ needs.setup.outputs.recheck == 'true' }}
75-
runs-on: ubuntu-20.04
76-
steps:
38+
- run: |
39+
git config --global user.email "support@tensorchord.ai"
40+
git config --global user.name "CI[bot]"
41+
- run: ./scripts/ci_release.sh
42+
env:
43+
SEMVER: ${{ github.event.inputs.version }}
7744
- id: create-release
7845
uses: actions/create-release@v1
7946
env:
8047
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8148
with:
82-
tag_name: ${{ needs.setup.outputs.version }}
83-
release_name: ${{ needs.setup.outputs.version }}
49+
tag_name: v${{ github.event.inputs.version }}
50+
release_name: v${{ github.event.inputs.version }}
8451
draft: false
85-
prerelease: ${{ needs.setup.outputs.prerelease }}
52+
prerelease: ${{ github.event.inputs.prerelease }}
8653
outputs:
8754
upload_url: ${{ steps.create-release.outputs.upload_url }}
88-
upload_github_release:
89-
needs: ["setup", "create_github_release"]
90-
if: ${{ needs.setup.outputs.recheck == 'true' }}
55+
binary:
56+
needs: ["release"]
9157
strategy:
9258
matrix:
9359
include:
94-
- { version: 14, arch: amd64, full_arch: x86_64 }
95-
- { version: 14, arch: arm64, full_arch: aarch64 }
96-
- { version: 15, arch: amd64, full_arch: x86_64 }
97-
- { version: 15, arch: arm64, full_arch: aarch64 }
98-
- { version: 16, arch: amd64, full_arch: x86_64 }
99-
- { version: 16, arch: arm64, full_arch: aarch64 }
60+
- { version: 14, platform: amd64, arch: x86_64 }
61+
- { version: 14, platform: arm64, arch: aarch64 }
62+
- { version: 15, platform: amd64, arch: x86_64 }
63+
- { version: 15, platform: arm64, arch: aarch64 }
64+
- { version: 16, platform: amd64, arch: x86_64 }
65+
- { version: 16, platform: arm64, arch: aarch64 }
10066
runs-on: ubuntu-20.04
10167
steps:
10268
- name: Checkout
10369
uses: actions/checkout@v3
70+
with:
71+
ref: v${{ github.event.inputs.version }}
10472
- uses: actions/cache/restore@v3
10573
with:
10674
path: |
@@ -121,17 +89,16 @@ jobs:
12189
sudo apt-get -y install clang-16
12290
cargo install cargo-pgrx --git https://github.com/tensorchord/pgrx.git --rev $(cat Cargo.toml | grep "pgrx =" | awk -F'rev = "' '{print $2}' | cut -d'"' -f1)
12391
cargo pgrx init --pg${{ matrix.version }}=/usr/lib/postgresql/${{ matrix.version }}/bin/pg_config
124-
if [[ "${{ matrix.arch }}" == "arm64" ]]; then
92+
if [[ "${{ matrix.arch }}" == "aarch64" ]]; then
12593
sudo apt-get -y install crossbuild-essential-arm64
12694
fi
12795
- name: Build Release
128-
id: build_release
12996
run: |
13097
sudo apt-get -y install ruby-dev libarchive-tools
13198
sudo gem install --no-document fpm
13299
mkdir ./artifacts
133100
cargo pgrx package
134-
if [[ "${{ matrix.arch }}" == "arm64" ]]; then
101+
if [[ "${{ matrix.arch }}" == "aarch64" ]]; then
135102
cargo build --target aarch64-unknown-linux-gnu --release --features "pg${{ matrix.version }}" --no-default-features
136103
mv ./target/aarch64-unknown-linux-gnu/release/libvectors.so ./target/release/vectors-pg${{ matrix.version }}/usr/lib/postgresql/${{ matrix.version }}/lib/vectors.so
137104
fi
@@ -141,40 +108,40 @@ jobs:
141108
--input-type dir \
142109
--output-type deb \
143110
--name vectors-pg${{ matrix.version }} \
144-
--version ${{ needs.setup.outputs.version }} \
111+
--version ${{ github.event.inputs.version }} \
145112
--license apache2 \
146113
--deb-no-default-config-files \
147-
--package ../vectors-pg${{ matrix.version }}-${{ needs.setup.outputs.version }}-${{ matrix.full_arch }}-unknown-linux-gnu.deb \
148-
--architecture ${{ matrix.arch }} \
114+
--package ../vectors-pg${{ matrix.version }}_${{ github.event.inputs.version }}_${{ matrix.platform }}.deb \
115+
--architecture ${{ matrix.platform }} \
149116
.
150-
- name: Upload Release / DEB
151-
id: upload_release_deb
117+
- name: Upload Release
152118
uses: actions/upload-release-asset@v1
153119
env:
154120
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
155121
with:
156-
upload_url: ${{ needs.create_github_release.outputs.upload_url }}
157-
asset_path: ./vectors-pg${{ matrix.version }}-${{ needs.setup.outputs.version }}-${{ matrix.full_arch }}-unknown-linux-gnu.deb
158-
asset_name: vectors-pg${{ matrix.version }}-${{ needs.setup.outputs.version }}-${{ matrix.full_arch }}-unknown-linux-gnu.deb
122+
upload_url: ${{ needs.release.outputs.upload_url }}
123+
asset_path: ./vectors-pg${{ matrix.version }}_${{ github.event.inputs.version }}_${{ matrix.platform }}.deb
124+
asset_name: vectors-pg${{ matrix.version }}_${{ github.event.inputs.version }}_${{ matrix.platform }}.deb
159125
asset_content_type: application/vnd.debian.binary-package
160126
docker_binary_release:
161-
needs: ["setup", "create_github_release", "upload_github_release"]
162-
if: ${{ needs.setup.outputs.recheck == 'true' }}
127+
needs: ["release", "binary"]
163128
strategy:
164129
matrix:
165130
include:
166-
- { version: 14, arch: amd64, full_arch: x86_64 }
167-
- { version: 14, arch: arm64, full_arch: aarch64 }
168-
- { version: 15, arch: amd64, full_arch: x86_64 }
169-
- { version: 15, arch: arm64, full_arch: aarch64 }
170-
- { version: 16, arch: amd64, full_arch: x86_64 }
171-
- { version: 16, arch: arm64, full_arch: aarch64 }
131+
- { version: 14, platform: amd64, arch: x86_64 }
132+
- { version: 14, platform: arm64, arch: aarch64 }
133+
- { version: 15, platform: amd64, arch: x86_64 }
134+
- { version: 15, platform: arm64, arch: aarch64 }
135+
- { version: 16, platform: amd64, arch: x86_64 }
136+
- { version: 16, platform: arm64, arch: aarch64 }
172137
runs-on: ubuntu-20.04
173138
steps:
174139
- name: Checkout
175140
uses: actions/checkout@v3
141+
with:
142+
ref: v${{ github.event.inputs.version }}
176143
- name: Download
177-
run: wget -O pgvecto-rs-binary-release.deb https://github.com/tensorchord/pgvecto.rs/releases/download/${{ needs.setup.outputs.version }}/vectors-pg${{ matrix.version }}-${{ needs.setup.outputs.version }}-${{ matrix.full_arch }}-unknown-linux-gnu.deb
144+
run: wget -O pgvecto-rs-binary-release.deb https://github.com/tensorchord/pgvecto.rs/releases/download/v${{ github.event.inputs.version }}/vectors-pg${{ matrix.version }}_${{ github.event.inputs.version }}_${{ matrix.platform }}.deb
178145
- name: Set up QEMU
179146
uses: docker/setup-qemu-action@v3
180147
- name: Set up Docker Buildx
@@ -189,12 +156,11 @@ jobs:
189156
with:
190157
context: .
191158
push: true
192-
platforms: "linux/${{ matrix.arch }}"
159+
platforms: "linux/${{ matrix.platform }}"
193160
file: ./docker/binary_release.Dockerfile
194-
tags: tensorchord/pgvecto-rs-binary:pg${{ matrix.version }}-${{ needs.setup.outputs.version }}-${{ matrix.arch }}
161+
tags: tensorchord/pgvecto-rs-binary:pg${{ matrix.version }}-${{ github.event.inputs.version }}-${{ matrix.platform }}
195162
docker_release:
196-
needs: ["setup", "create_github_release", "upload_github_release", "docker_binary_release"]
197-
if: ${{ needs.setup.outputs.recheck == 'true' }}
163+
needs: ["docker_binary_release"]
198164
runs-on: ubuntu-20.04
199165
strategy:
200166
matrix:
@@ -205,13 +171,15 @@ jobs:
205171
steps:
206172
- name: Checkout
207173
uses: actions/checkout@v3
174+
with:
175+
ref: v${{ github.event.inputs.version }}
208176
- name: Variables
209177
id: variables
210178
uses: actions/github-script@v6
211179
with:
212180
script: |
213181
let tags = [
214-
"tensorchord/pgvecto-rs:pg${{ matrix.version }}-${{ needs.setup.outputs.version }}",
182+
"tensorchord/pgvecto-rs:pg${{ matrix.version }}-v${{ github.event.inputs.version }}",
215183
"tensorchord/pgvecto-rs:pg${{ matrix.version }}-latest",
216184
];
217185
if ("${{ matrix.latest }}" == "true") {
@@ -235,6 +203,6 @@ jobs:
235203
platforms: "linux/amd64,linux/arm64"
236204
file: ./docker/pgvecto-rs.Dockerfile
237205
build-args: |
238-
TAG=pg${{ matrix.version }}-${{ needs.setup.outputs.version }}
206+
TAG=pg${{ matrix.version }}-v${{ github.event.inputs.version }}
239207
POSTGRES_VERSION=${{ matrix.version }}
240208
tags: ${{ steps.variables.outputs.tags }}

scripts/ci_release.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
sed -i "s/@CARGO_VERSION@/${SEMVER}/g" ./vectors.control
5+
6+
git add -A
7+
git commit -m "chore: release"
8+
git tag v$SEMVER
9+
git push origin v$SEMVER

0 commit comments

Comments
 (0)