|
| 1 | +name: Publish Postgres Docker images |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: ["main"] |
| 7 | + |
| 8 | +jobs: |
| 9 | + publish_postgres: |
| 10 | + name: Publish Postgres Images |
| 11 | + runs-on: ubuntu-latest |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + os: [ubuntu, alpine] |
| 15 | + postgres_version: [12, 13, 14, 15, 16, 17] |
| 16 | + exclude: |
| 17 | + - os: alpine |
| 18 | + postgres_version: 12 |
| 19 | + - os: alpine |
| 20 | + postgres_version: 13 |
| 21 | + - os: alpine |
| 22 | + postgres_version: 14 |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Check out the repo |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Log in to Docker Hub |
| 29 | + uses: docker/login-action@v3 |
| 30 | + with: |
| 31 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 32 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 33 | + |
| 34 | + - name: Extract metadata (tags, labels) for Docker |
| 35 | + id: meta |
| 36 | + uses: docker/metadata-action@v5 |
| 37 | + with: |
| 38 | + images: binaryoverload/postgresql-client |
| 39 | + tags: | |
| 40 | + type=raw,value=${{ matrix.postgres_version }},enable=${{ matrix.os == 'ubuntu' }} |
| 41 | + type=raw,value=${{ matrix.postgres_version }}-${{ matrix.os }} |
| 42 | +
|
| 43 | + - name: Set up Docker Buildx |
| 44 | + uses: docker/setup-buildx-action@v3 |
| 45 | + |
| 46 | + - name: Build and push Docker image |
| 47 | + uses: docker/build-push-action@v5 |
| 48 | + with: |
| 49 | + context: ./postgres |
| 50 | + platforms: linux/amd64,linux/arm64 |
| 51 | + file: ./postgres/Dockerfile.${{ matrix.os }} |
| 52 | + push: true |
| 53 | + tags: ${{ steps.meta.outputs.tags }} |
| 54 | + labels: ${{ steps.meta.outputs.labels }} |
| 55 | + build-args: | |
| 56 | + POSTGRES_VERSION=${{ matrix.postgres_version }} |
| 57 | + cache-from: type=gha |
| 58 | + cache-to: type=gha,mode=max |
| 59 | + |
| 60 | + publish_mariadb: |
| 61 | + name: Publish MariaDB Images |
| 62 | + runs-on: ubuntu-latest |
| 63 | + strategy: |
| 64 | + matrix: |
| 65 | + os: [ubuntu, alpine] |
| 66 | + |
| 67 | + steps: |
| 68 | + - name: Check out the repo |
| 69 | + uses: actions/checkout@v4 |
| 70 | + |
| 71 | + - name: Log in to Docker Hub |
| 72 | + uses: docker/login-action@v3 |
| 73 | + with: |
| 74 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 75 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 76 | + |
| 77 | + - name: Extract metadata (tags, labels) for Docker |
| 78 | + id: meta |
| 79 | + uses: docker/metadata-action@v5 |
| 80 | + with: |
| 81 | + images: binaryoverload/mariadb-client |
| 82 | + tags: | |
| 83 | + type=raw,value=latest,enable=${{ matrix.os == 'ubuntu' }} |
| 84 | + type=raw,value=${{ matrix.os }} |
| 85 | +
|
| 86 | + - name: Set up Docker Buildx |
| 87 | + uses: docker/setup-buildx-action@v3 |
| 88 | + |
| 89 | + - name: Build and push Docker image |
| 90 | + uses: docker/build-push-action@v5 |
| 91 | + with: |
| 92 | + context: ./mariadb |
| 93 | + platforms: linux/amd64,linux/arm64 |
| 94 | + file: ./mariadb/Dockerfile.${{ matrix.os }} |
| 95 | + push: true |
| 96 | + tags: ${{ steps.meta.outputs.tags }} |
| 97 | + labels: ${{ steps.meta.outputs.labels }} |
| 98 | + cache-from: type=gha |
| 99 | + cache-to: type=gha,mode=max |
0 commit comments