1
1
name : Release
2
2
3
3
on :
4
- schedule :
5
- # 00:00 UTC+8 -> 16:00
6
- - cron : " 0 16 * * *"
7
4
workflow_dispatch :
8
5
inputs :
9
6
version :
10
7
type : string
11
- description : The version to be released.
8
+ description : Version
12
9
required : true
13
10
prerelease :
14
11
type : boolean
15
- description : Prerelease or not.
12
+ description : Prerelease
16
13
required : true
17
- default : true
14
+ default : false
18
15
19
16
permissions :
20
17
contents : write
26
23
RUSTC_WRAPPER : sccache
27
24
28
25
jobs :
29
- setup :
26
+ release :
30
27
runs-on : ubuntu-20.04
31
28
steps :
32
29
- name : Checkout
33
30
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
44
32
with :
45
33
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.`);
67
37
}
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 }}
77
44
- id : create-release
78
45
uses : actions/create-release@v1
79
46
env :
80
47
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
81
48
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 }}
84
51
draft : false
85
- prerelease : ${{ needs.setup.outputs .prerelease }}
52
+ prerelease : ${{ github.event.inputs .prerelease }}
86
53
outputs :
87
54
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"]
91
57
strategy :
92
58
matrix :
93
59
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 }
100
66
runs-on : ubuntu-20.04
101
67
steps :
102
68
- name : Checkout
103
69
uses : actions/checkout@v3
70
+ with :
71
+ ref : v${{ github.event.inputs.version }}
104
72
- uses : actions/cache/restore@v3
105
73
with :
106
74
path : |
@@ -121,17 +89,16 @@ jobs:
121
89
sudo apt-get -y install clang-16
122
90
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)
123
91
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
125
93
sudo apt-get -y install crossbuild-essential-arm64
126
94
fi
127
95
- name : Build Release
128
- id : build_release
129
96
run : |
130
97
sudo apt-get -y install ruby-dev libarchive-tools
131
98
sudo gem install --no-document fpm
132
99
mkdir ./artifacts
133
100
cargo pgrx package
134
- if [[ "${{ matrix.arch }}" == "arm64 " ]]; then
101
+ if [[ "${{ matrix.arch }}" == "aarch64 " ]]; then
135
102
cargo build --target aarch64-unknown-linux-gnu --release --features "pg${{ matrix.version }}" --no-default-features
136
103
mv ./target/aarch64-unknown-linux-gnu/release/libvectors.so ./target/release/vectors-pg${{ matrix.version }}/usr/lib/postgresql/${{ matrix.version }}/lib/vectors.so
137
104
fi
@@ -141,40 +108,40 @@ jobs:
141
108
--input-type dir \
142
109
--output-type deb \
143
110
--name vectors-pg${{ matrix.version }} \
144
- --version ${{ needs.setup.outputs .version }} \
111
+ --version ${{ github.event.inputs .version }} \
145
112
--license apache2 \
146
113
--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 }} \
149
116
.
150
- - name : Upload Release / DEB
151
- id : upload_release_deb
117
+ - name : Upload Release
152
118
uses : actions/upload-release-asset@v1
153
119
env :
154
120
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
155
121
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
159
125
asset_content_type : application/vnd.debian.binary-package
160
126
docker_binary_release :
161
- needs : ["setup", "create_github_release", "upload_github_release"]
162
- if : ${{ needs.setup.outputs.recheck == 'true' }}
127
+ needs : ["release", "binary"]
163
128
strategy :
164
129
matrix :
165
130
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 }
172
137
runs-on : ubuntu-20.04
173
138
steps :
174
139
- name : Checkout
175
140
uses : actions/checkout@v3
141
+ with :
142
+ ref : v${{ github.event.inputs.version }}
176
143
- 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
178
145
- name : Set up QEMU
179
146
uses : docker/setup-qemu-action@v3
180
147
- name : Set up Docker Buildx
@@ -189,12 +156,11 @@ jobs:
189
156
with :
190
157
context : .
191
158
push : true
192
- platforms : " linux/${{ matrix.arch }}"
159
+ platforms : " linux/${{ matrix.platform }}"
193
160
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 }}
195
162
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"]
198
164
runs-on : ubuntu-20.04
199
165
strategy :
200
166
matrix :
@@ -205,13 +171,15 @@ jobs:
205
171
steps :
206
172
- name : Checkout
207
173
uses : actions/checkout@v3
174
+ with :
175
+ ref : v${{ github.event.inputs.version }}
208
176
- name : Variables
209
177
id : variables
210
178
uses : actions/github-script@v6
211
179
with :
212
180
script : |
213
181
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 }}",
215
183
"tensorchord/pgvecto-rs:pg${{ matrix.version }}-latest",
216
184
];
217
185
if ("${{ matrix.latest }}" == "true") {
@@ -235,6 +203,6 @@ jobs:
235
203
platforms : " linux/amd64,linux/arm64"
236
204
file : ./docker/pgvecto-rs.Dockerfile
237
205
build-args : |
238
- TAG=pg${{ matrix.version }}-${{ needs.setup.outputs .version }}
206
+ TAG=pg${{ matrix.version }}-v ${{ github.event.inputs .version }}
239
207
POSTGRES_VERSION=${{ matrix.version }}
240
208
tags : ${{ steps.variables.outputs.tags }}
0 commit comments