0.1.1 #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| 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" | |
| steps: | |
| - name: Semver | |
| id: semver | |
| uses: actions/github-script@v7 | |
| 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); | |
| outputs: | |
| SEMVER: ${{ steps.semver.outputs.SEMVER }} | |
| build: | |
| needs: ["semver"] | |
| 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 }} | |
| ARCH: ${{ matrix.arch }} | |
| PLATFORM: ${{ matrix.arch == 'x86_64' && 'amd64' || 'arm64' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Environment | |
| run: ./tools/setup.sh ${{ matrix.version }} | |
| - name: Build | |
| run: ./tools/package.sh | |
| - name: Upload Artifacts | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release upload --clobber $SEMVER ./build/postgresql-${VERSION}-pg-tokenizer_${SEMVER}-1_${PLATFORM}.deb | |
| gh release upload --clobber $SEMVER ./build/postgresql-${VERSION}-pg-tokenizer_${SEMVER}_${ARCH}-linux-gnu.zip | |
| docker: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| needs: ["semver", "build"] | |
| strategy: | |
| matrix: | |
| version: ["14", "15", "16", "17", "18"] | |
| env: | |
| SEMVER: ${{ needs.semver.outputs.SEMVER }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| mkdir -p build | |
| for arch in amd64 arm64; do | |
| gh release download $SEMVER --pattern "postgresql-${{ matrix.version }}-pg-tokenizer_${SEMVER}-1_${arch}.deb" --output ./build/postgresql-${{ matrix.version }}-pg-tokenizer_${SEMVER}-1_${arch}.deb | |
| done | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERIO_USERNAME }} | |
| password: ${{ secrets.DOCKERIO_TOKEN }} | |
| - name: Login to the GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Push binary release to Docker Registry | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| platforms: "linux/amd64,linux/arm64" | |
| file: ./docker/binary.Dockerfile | |
| tags: | | |
| tensorchord/pg_tokenizer-binary:pg${{ matrix.version }}-v${{ env.SEMVER }} | |
| ghcr.io/tensorchord/pg_tokenizer-binary:pg${{ matrix.version }}-v${{ env.SEMVER }} | |
| build-args: | | |
| PG_VERSION=${{ matrix.version }} | |
| SEMVER=${{ env.SEMVER }} | |
| # - name: Push PostgreSQL release to Docker Registry | |
| # uses: docker/build-push-action@v6 | |
| # with: | |
| # context: . | |
| # push: true | |
| # platforms: "linux/amd64,linux/arm64" | |
| # file: ./docker/Dockerfile | |
| # tags: | | |
| # tensorchord/pg_tokenizer-postgres:pg${{ matrix.version }}-v${{ env.SEMVER }}-${{ env.PLATFORM }} | |
| # ghcr.io/tensorchord/pg_tokenizer-postgres:pg${{ matrix.version }}-v${{ env.SEMVER }}-${{ env.PLATFORM }} | |
| # build-args: | | |
| # PG_VERSION=${{ matrix.version }} | |
| # SEMVER=${{ env.SEMVER }} | |
| # VCHORD_VERSION=0.2.0 |