diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fe1ce085..64791712 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,6 +25,7 @@ env: permissions: contents: write + packages: write pull-requests: read jobs: @@ -147,46 +148,44 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Variables - id: variables - uses: actions/github-script@v7 + - name: Generate docker image tags + id: metadata + uses: docker/metadata-action@v5 with: - script: | - if ("${{ matrix.rootless }}" == "true") { - core.setOutput('tags', "tensorchord/pgvecto-rs:pg${{ matrix.version }}-v${{ github.event.inputs.version }}-rootless"); - } else { - core.setOutput('tags', "tensorchord/pgvecto-rs:pg${{ matrix.version }}-v${{ github.event.inputs.version }}"); - } + flavor: | + # Disable latest tag + latest=false + images: | + name=ghcr.io/${{ github.repository }} + name=tensorchord/pgvecto-rs + tags: | + type=raw,value=pg${{ matrix.version }}-v${{ github.event.inputs.version }}-rootless,enable=${{ matrix.rootless }} + type=raw,value=pg${{ matrix.version }}-v${{ github.event.inputs.version }},enable=${{ !matrix.rootless }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3.3.0 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERIO_USERNAME }} password: ${{ secrets.DOCKERIO_TOKEN }} - - name: Push postgres with pgvecto.rs to Docker Registry(rootful) + - name: Push postgres with pgvecto.rs to Docker Registry if: matrix.rootless == false uses: docker/build-push-action@v4 with: context: . push: true platforms: "linux/amd64,linux/arm64" - file: ./docker/pgvecto-rs.Dockerfile - build-args: | - FROM_TAG=pg${{ matrix.version }}-v${{ github.event.inputs.version }} - POSTGRES_VERSION=${{ matrix.version }} - tags: ${{ steps.variables.outputs.tags }} - - name: Push postgres with pgvecto.rs to Docker Registry(rootless) - if: matrix.rootless == true - uses: docker/build-push-action@v4 - with: - context: . - push: true - platforms: "linux/amd64,linux/arm64" - file: ./docker/pgvecto-rs-rootless.Dockerfile + file: ${{ matrix.rootless == 'true' && './docker/pgvecto-rs-rootless.Dockerfile' || './docker/pgvecto-rs.Dockerfile' }} build-args: | FROM_TAG=pg${{ matrix.version }}-v${{ github.event.inputs.version }} POSTGRES_VERSION=${{ matrix.version }} - tags: ${{ steps.variables.outputs.tags }} + tags: ${{ steps.metadata.outputs.tags }} + labels: ${{ steps.metadata.outputs.labels }}