Skip to content

Publish

Publish #6

Workflow file for this run

name: Publish
on:
release:
types: [created]
workflow_dispatch:
inputs:
tag:
description: 'tag name (semver without v-prefix)'
required: true
type: string
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
semver:
runs-on: ubuntu-latest
outputs:
SEMVER: ${{ steps.semver.outputs.SEMVER }}
steps:
- uses: actions/github-script@v7
id: semver
with:
script: |
const tag = "${{ github.event.inputs.tag }}" || "${{ github.event.release.tag_name }}";
console.log(`Tag: ${tag}`);
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-]+)*))?$/;
if (!r.test(tag)) {
core.setFailed(`Action failed with an invalid semver.`);
}
core.setOutput('SEMVER', tag);
get-dependencies-version:
runs-on: ubuntu-latest
outputs:
PG_TOKENIZER_VERSION: ${{ steps.get-dependencies-version.outputs.PG_TOKENIZER_VERSION }}
VCHORD_VERSION: ${{ steps.get-dependencies-version.outputs.VCHORD_VERSION }}
steps:
- name: Get dependencies latest version
id: get-dependencies-version
run: |
PG_TOKENIZER_VERSION=$(curl -sSL https://api.github.com/repos/tensorchord/pg_tokenizer.rs/releases/latest | jq -r '.tag_name')
if [ "$PG_TOKENIZER_VERSION" == "null" ]; then
echo "Failed to get PG_TOKENIZER_VERSION"
exit 1
else
echo "PG_TOKENIZER_VERSION=$PG_TOKENIZER_VERSION" >> $GITHUB_OUTPUT
fi
VCHORD_VERSION=$(curl -sSL https://api.github.com/repos/tensorchord/vectorchord/releases/latest | jq -r '.tag_name')
if [ "$VCHORD_VERSION" == "null" ]; then
echo "Failed to get VCHORD_VERSION"
exit 1
else
echo "VCHORD_VERSION=$VCHORD_VERSION" >> $GITHUB_OUTPUT
fi
build:
needs: ["semver", "get-dependencies-version"]
strategy:
matrix:
version: ["14", "15", "16", "17", "18"]
arch: ["x86_64", "aarch64"]
runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }}
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: "-Dwarnings"
SEMVER: ${{ needs.semver.outputs.SEMVER }}
VERSION: ${{ matrix.version }}
POSTGRES_VERSION: ${{ matrix.version }}
ARCH: ${{ matrix.arch }}
PLATFORM: ${{ matrix.arch == 'x86_64' && 'amd64' || 'arm64' }}
PG_TOKENIZER_VERSION: ${{ needs.get-dependencies-version.outputs.PG_TOKENIZER_VERSION }}
steps:
- uses: actions/checkout@v4
- name: Set up Environment
run: ./tools/setup.sh
- name: Build
run: ./tools/package.sh
- name: Upload Artifacts
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload --clobber $SEMVER ./build/postgresql-${VERSION}-vchord-bm25_${SEMVER}-1_${PLATFORM}.deb
gh release upload --clobber $SEMVER ./build/postgresql-${VERSION}-vchord-bm25_${SEMVER}_${ARCH}-linux-gnu.zip