diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b38b7c8..91122b5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,6 @@ --- -name: Build Docker image +name: Build and publish Docker image env: POSTGRES_VERSION: "15.3" @@ -13,11 +13,25 @@ on: workflow_dispatch: jobs: - build-image: + build-and-publish-image: runs-on: ubuntu-latest + permissions: + packages: write steps: - uses: actions/checkout@v4 + - name: Login to the container registry + uses: docker/login-action@v3 + with: + registry: https://ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build image run: | docker build --build-arg="POSTGRES_VERSION=${POSTGRES_VERSION}" --build-arg="PGVECTOR_VERSION=${PGVECTOR_VERSION}" --tag "ghcr.io/zapgram/cimg-postgres-pgvector:${POSTGRES_VERSION}-${PGVECTOR_VERSION}" . + + - name: Publish image + if: github.ref_name == 'trunk' + run: | + docker push "ghcr.io/zapgram/cimg-postgres-pgvector:${POSTGRES_VERSION}-${PGVECTOR_VERSION}"