Automatic update #142
Workflow file for this run
This file contains 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: Publish | |
on: | |
push: | |
tags: | |
- v* | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: 'bash -Eeuo pipefail -x {0}' | |
env: | |
IMAGE_STAGING: quay.io/enterprisedb/pgbouncer-testing | |
IMAGE_RELEASE: quay.io/enterprisedb/pgbouncer | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-22.04 | |
steps: | |
- | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- | |
name: Detect platforms | |
run: | | |
# Available architecture on UBI8 are: linux/amd64, linux/arm64, linux/ppc64le, linux/s390x | |
# Keep in mind that adding more platforms (architectures) will increase the building | |
# time even if we use the ghcache for the building process. | |
platforms="linux/amd64,linux/arm64,linux/ppc64le,linux/s390x" | |
echo "PLATFORMS=${platforms}" >> $GITHUB_ENV | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: ${{ env.PLATFORMS }} | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to quay.io | |
uses: docker/login-action@v3 | |
with: | |
registry: quay.io/enterprisedb | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_TOKEN }} | |
- | |
name: Set image repository | |
run: | | |
if [[ "${GITHUB_REF}" =~ refs/tags/v(.*) ]]; then | |
echo "IMAGES=${{ env.IMAGE_RELEASE }},${{ env.IMAGE_STAGING }}" >> $GITHUB_ENV | |
else | |
echo "IMAGES=${{ env.IMAGE_STAGING }}" >> $GITHUB_ENV | |
fi | |
- | |
name: Gather image info | |
run: | | |
pgbouncer_version=$(jq -r '.PGBOUNCER_VERSION' .versions.json) | |
release_version=$(jq -r '.IMAGE_RELEASE_VERSION' .versions.json) | |
ubi_version=$(jq -r '.UBI_VERSION' .versions.json) | |
echo "PGBOUNCER_VERSION=${pgbouncer_version}" >> $GITHUB_ENV | |
echo "RELEASE_VERSION=${release_version}" >> $GITHUB_ENV | |
echo "UBI_VERSION=${ubi_version}" >> $GITHUB_ENV | |
- | |
name: Docker meta | |
id: docker-meta | |
uses: docker/metadata-action@v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: "${{ env.IMAGES }}" | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=match,pattern=v(.*),group=1 | |
type=match,pattern=v(.*)-\d+,group=1 | |
type=ref,event=branch | |
labels: | | |
org.opencontainers.image.version=${{ env.PGBOUNCER_VERSION }} | |
org.opencontainers.image.revision=${{ env.RELEASE_VERSION }} | |
org.opencontainers.image.licenses=PostgreSQL | |
- | |
name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
secrets: | | |
"cs_script=${{ secrets.CS_SCRIPT }}" | |
platforms: ${{ env.PLATFORMS }} | |
context: . | |
push: true | |
tags: ${{ steps.docker-meta.outputs.tags }} | |
labels: ${{ steps.docker-meta.outputs.labels }} | |
- | |
# Send a notification on release failure | |
name: Slack Notification | |
uses: rtCamp/action-slack-notify@v2 | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
env: | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_ICON: https://avatars.githubusercontent.com/u/44036562?size=48 | |
SLACK_USERNAME: ghBot | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_MESSAGE: Failure releasing PgBouncer image |