|
7 | 7 | release: |
8 | 8 | if: ${{ startsWith(github.ref, 'refs/tags/v') }} |
9 | 9 | runs-on: ubuntu-latest |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + pg_version: |
| 13 | + - major: "15" |
| 14 | + full: "15.14" |
| 15 | + - major: "16" |
| 16 | + full: "16.10" |
| 17 | + - major: "17" |
| 18 | + full: "17.6" |
10 | 19 |
|
11 | 20 | steps: |
12 | | - - |
13 | | - name: Set up QEMU |
14 | | - uses: docker/setup-qemu-action@v3 |
15 | | - - |
16 | | - name: Set up Docker Buildx |
17 | | - uses: docker/setup-buildx-action@v3 |
18 | | - with: |
19 | | - version: v0.9.1 |
20 | | - - |
21 | | - name: Login to DockerHub |
22 | | - uses: docker/login-action@v3 |
23 | | - with: |
24 | | - username: ${{ secrets.DOCKERHUB_USERNAME }} |
25 | | - password: ${{ secrets.DOCKERHUB_TOKEN }} |
26 | 21 | - uses: actions/checkout@v5 |
27 | 22 | with: |
28 | 23 | fetch-depth: 0 |
29 | | - - |
30 | | - name: "Fetch latest tag" |
31 | | - id: get-latest-tag |
32 | | - uses: "WyriHaximus/github-action-get-previous-tag@v1" |
33 | | - - |
34 | | - name: Build and push Postgres 15 |
35 | | - id: docker_build_15 |
36 | | - uses: docker/build-push-action@v6 |
37 | | - with: |
38 | | - build-args: | |
39 | | - PG_VERSION=15.14 |
40 | | - PG_MAJOR_VERSION=15 |
41 | | - VERSION=${{ steps.get-latest-tag.outputs.tag }} |
42 | | - context: . |
43 | | - file: ./pg15/Dockerfile |
44 | | - push: true |
45 | | - tags: | |
46 | | - flyio/postgres-flex:15 |
47 | | - flyio/postgres-flex:15.14 |
48 | | - - |
49 | | - name: Build and push Postgres 15 Timescale DB |
50 | | - id: docker_build_15_timescaledb |
51 | | - uses: docker/build-push-action@v6 |
52 | | - with: |
53 | | - build-args: | |
54 | | - PG_VERSION=15.14 |
55 | | - PG_MAJOR_VERSION=15 |
56 | | - VERSION=${{ steps.get-latest-tag.outputs.tag }} |
57 | | - context: . |
58 | | - file: ./pg15/Dockerfile-timescaledb |
59 | | - push: true |
60 | | - tags: | |
61 | | - flyio/postgres-flex-timescaledb:15 |
62 | | - flyio/postgres-flex-timescaledb:15.14 |
63 | 24 |
|
64 | | - - |
65 | | - name: Build and push Postgres 16 |
66 | | - id: docker_build_16 |
67 | | - uses: docker/build-push-action@v6 |
68 | | - with: |
69 | | - build-args: | |
70 | | - PG_VERSION=16.10 |
71 | | - PG_MAJOR_VERSION=16 |
72 | | - VERSION=${{ steps.get-latest-tag.outputs.tag }} |
73 | | - context: . |
74 | | - file: ./pg16/Dockerfile |
75 | | - push: true |
76 | | - tags: | |
77 | | - flyio/postgres-flex:16 |
78 | | - flyio/postgres-flex:16.10 |
79 | | - - |
80 | | - name: Build and push Postgres 16 Timescale DB |
81 | | - id: docker_build_16_timescaledb |
82 | | - uses: docker/build-push-action@v6 |
| 25 | + - name: Get tag name |
| 26 | + id: tag |
| 27 | + run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT |
| 28 | + |
| 29 | + - name: Set up QEMU |
| 30 | + uses: docker/setup-qemu-action@v3 |
| 31 | + |
| 32 | + - name: Set up Docker Buildx |
| 33 | + uses: docker/setup-buildx-action@v3 |
| 34 | + |
| 35 | + - name: Log in to GitHub Container Registry |
| 36 | + uses: docker/login-action@v3 |
83 | 37 | with: |
84 | | - build-args: | |
85 | | - PG_VERSION=16.10 |
86 | | - PG_MAJOR_VERSION=16 |
87 | | - VERSION=${{ steps.get-latest-tag.outputs.tag }} |
88 | | - context: . |
89 | | - file: ./pg16/Dockerfile-timescaledb |
90 | | - push: true |
91 | | - tags: | |
92 | | - flyio/postgres-flex-timescaledb:16 |
93 | | - flyio/postgres-flex-timescaledb:16.10 |
| 38 | + registry: ghcr.io |
| 39 | + username: ${{ github.actor }} |
| 40 | + password: ${{ secrets.GITHUB_TOKEN }} |
94 | 41 |
|
95 | | - - |
96 | | - name: Build and push Postgres 17 |
97 | | - id: docker_build_17 |
| 42 | + - name: Build and push release |
98 | 43 | uses: docker/build-push-action@v6 |
99 | 44 | with: |
100 | | - build-args: | |
101 | | - PG_VERSION=17.6 |
102 | | - PG_MAJOR_VERSION=17 |
103 | | - VERSION=${{ steps.get-latest-tag.outputs.tag }} |
104 | 45 | context: . |
105 | | - file: ./pg17/Dockerfile |
| 46 | + file: ./pg${{ matrix.pg_version.major }}/Dockerfile |
106 | 47 | push: true |
107 | 48 | tags: | |
108 | | - flyio/postgres-flex:17 |
109 | | - flyio/postgres-flex:17.6 |
110 | | - - |
111 | | - name: Build and push Postgres 17 Timescale DB |
112 | | - id: docker_build_17_timescaledb |
113 | | - uses: docker/build-push-action@v6 |
114 | | - with: |
| 49 | + ghcr.io/${{ github.repository }}/postgres-flex:${{ matrix.pg_version.major }} |
| 50 | + ghcr.io/${{ github.repository }}/postgres-flex:${{ matrix.pg_version.full }} |
| 51 | + ghcr.io/${{ github.repository }}/postgres-flex:${{ steps.tag.outputs.TAG }}-${{ matrix.pg_version.major }} |
115 | 52 | build-args: | |
116 | | - PG_VERSION=17.6 |
117 | | - PG_MAJOR_VERSION=17 |
118 | | - VERSION=${{ steps.get-latest-tag.outputs.tag }} |
119 | | - context: . |
120 | | - file: ./pg17/Dockerfile-timescaledb |
121 | | - push: true |
122 | | - tags: | |
123 | | - flyio/postgres-flex-timescaledb:17 |
124 | | - flyio/postgres-flex-timescaledb:17.6 |
125 | | -
|
| 53 | + PG_VERSION=${{ matrix.pg_version.full }} |
| 54 | + PG_MAJOR_VERSION=${{ matrix.pg_version.major }} |
| 55 | + VERSION=${{ steps.tag.outputs.TAG }} |
| 56 | + cache-from: type=gha |
| 57 | + cache-to: type=gha,mode=max |
126 | 58 |
|
127 | | - - |
128 | | - name: Postgres 15 Image digest |
129 | | - run: echo ${{ steps.docker_build_15.outputs.digest }} |
130 | | - - |
131 | | - name: Postgres 15 TimescaleDB Image digest |
132 | | - run: echo ${{ steps.docker_build_15_timescaledb.outputs.digest }} |
133 | | - - |
134 | | - name: Postgres 16 Image digest |
135 | | - run: echo ${{ steps.docker_build_16.outputs.digest }} |
136 | | - - |
137 | | - name: Postgres 16 TimescaleDB Image digest |
138 | | - run: echo ${{ steps.docker_build_16_timescaledb.outputs.digest }} |
139 | | - - |
140 | | - name: Postgres 17 Image digest |
141 | | - run: echo ${{ steps.docker_build_17.outputs.digest }} |
142 | | - - |
143 | | - name: Postgres 17 TimescaleDB Image digest |
144 | | - run: echo ${{ steps.docker_build_17_timescaledb.outputs.digest }} |
| 59 | + - name: Image digest |
| 60 | + run: echo "Built ${{ matrix.pg_version.major }} for release ${{ steps.tag.outputs.TAG }}" |
0 commit comments