|
| 1 | +--- |
| 2 | +name: Release |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + pull-requests: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + release: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + name: Release |
| 17 | + outputs: |
| 18 | + release_created: ${{ steps.release.outputs.release_created }} |
| 19 | + tag_name: ${{ steps.release.outputs.tag_name }} |
| 20 | + permissions: |
| 21 | + contents: write |
| 22 | + pull-requests: write |
| 23 | + |
| 24 | + steps: |
| 25 | + - uses: google-github-actions/release-please-action@v4 |
| 26 | + id: release |
| 27 | + |
| 28 | + container: |
| 29 | + if: needs.release.outputs.release_created |
| 30 | + runs-on: ubuntu-latest |
| 31 | + name: Build (and Push) Container Image |
| 32 | + needs: |
| 33 | + - release |
| 34 | + permissions: |
| 35 | + contents: write |
| 36 | + packages: write |
| 37 | + |
| 38 | + steps: |
| 39 | + - name: Checkout repository |
| 40 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
| 41 | + with: |
| 42 | + fetch-depth: 0 |
| 43 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + |
| 45 | + - name: Setup QEMU |
| 46 | + uses: docker/setup-qemu-action@v3 |
| 47 | + - name: Setup Docker Buildx |
| 48 | + uses: docker/setup-buildx-action@v3 |
| 49 | + |
| 50 | + - name: Login to ghcr.io |
| 51 | + uses: docker/login-action@v3 |
| 52 | + with: |
| 53 | + registry: ghcr.io |
| 54 | + username: ${{ github.actor }} |
| 55 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + |
| 57 | + - name: Get Upstream Tags |
| 58 | + id: from_tag |
| 59 | + run: | |
| 60 | + POSTGRESQL_IMAGE=$(cat Dockerfile | grep 'FROM ghcr.io/cloudnative-pg/postgresql:') |
| 61 | + POSTGRESQL_FROM_TAG=$(echo $POSTGRESQL_IMAGE | cut -d':' -f2) |
| 62 | + echo "postgresql=${POSTGRESQL_FROM_TAG}" >> "$GITHUB_OUTPUT" |
| 63 | + PGVECTO_IMAGE=$(cat Dockerfile | grep 'FROM tensorchord/pgvecto-rs-binary:') |
| 64 | + PGVECTO_FROM_TAG=$(echo $PGVECTO_IMAGE | cut -d'-' -f4) |
| 65 | + echo "pgvecto=${PGVECTO_FROM_TAG}" >> "$GITHUB_OUTPUT" |
| 66 | +
|
| 67 | + - name: Build and Push Image |
| 68 | + uses: docker/build-push-action@v5 |
| 69 | + with: |
| 70 | + context: . |
| 71 | + platforms: linux/amd64,linux/arm64 |
| 72 | + push: true |
| 73 | + tags: | |
| 74 | + ghcr.io/muhlba91/postgresql-pgvecto:latest |
| 75 | + ghcr.io/muhlba91/postgresql-pgvecto:${{ github.sha }} |
| 76 | + ghcr.io/muhlba91/postgresql-pgvecto:${{ steps.from_tag.outputs.postgresql }}-${{ steps.from_tag.outputs.pgvecto }}-${{ needs.release.outputs.tag_name }} |
| 77 | + build-args: | |
| 78 | + CI_COMMIT_TIMESTAMP=${{ github.event.repository.updated_at }} |
| 79 | + CI_COMMIT_SHA=${{ github.sha }} |
| 80 | + CI_COMMIT_TAG=${{ steps.from_tag.outputs.postgresql }}-${{ steps.from_tag.outputs.pgvecto }}-${{ needs.release.outputs.tag_name }} |
| 81 | + CI_UPSTREAM_VERSION=${{ steps.from_tag.outputs.postgresql }}-${{ steps.from_tag.outputs.pgvecto }} |
0 commit comments