|
7 | 7 | branches: |
8 | 8 | - master |
9 | 9 | tags: |
10 | | - - '**' |
| 10 | + - "**" |
11 | 11 | workflow_dispatch: {} |
12 | 12 |
|
13 | 13 | env: |
@@ -218,3 +218,49 @@ jobs: |
218 | 218 | parent: false |
219 | 219 | process_gcloudignore: false |
220 | 220 |
|
| 221 | + deploy-postgres-dockerhub: |
| 222 | + runs-on: ubuntu-latest |
| 223 | + needs: postgres-e2e-tests |
| 224 | + if: | |
| 225 | + github.ref == 'refs/heads/master' || |
| 226 | + startsWith(github.ref, 'refs/tags/') || |
| 227 | + startsWith(github.ref, 'refs/heads/feature.') |
| 228 | +
|
| 229 | + steps: |
| 230 | + - name: Download Docker image |
| 231 | + uses: actions/download-artifact@v6 |
| 232 | + with: |
| 233 | + name: postgres-docker-image |
| 234 | + path: /tmp |
| 235 | + |
| 236 | + - name: Load Docker image |
| 237 | + run: docker load --input /tmp/postgres-image.tar |
| 238 | + |
| 239 | + - name: Log in to Docker Hub |
| 240 | + uses: docker/login-action@v3 |
| 241 | + with: |
| 242 | + username: ${{ secrets.DOCKER_USER }} |
| 243 | + password: ${{ secrets.DOCKER_PASS }} |
| 244 | + |
| 245 | + - name: Determine Docker tag |
| 246 | + id: docker-tag |
| 247 | + run: | |
| 248 | + if [ "${{ github.ref }}" == "refs/heads/master" ]; then |
| 249 | + DOCKER_TAG="${{ github.sha }}" |
| 250 | + elif [[ "${{ github.ref }}" == refs/tags/* ]]; then |
| 251 | + DOCKER_TAG="${{ github.ref_name }}" |
| 252 | + elif [[ "${{ github.ref }}" == refs/heads/feature.* ]]; then |
| 253 | + DOCKER_TAG="${{ github.ref_name }}" |
| 254 | + else |
| 255 | + echo "Not pushing to DockerHub for ref=${{ github.ref }}" |
| 256 | + exit 0 |
| 257 | + fi |
| 258 | + echo "tag=${DOCKER_TAG}" >> $GITHUB_OUTPUT |
| 259 | + echo "full_tag=${{ secrets.DOCKERHUB_REPO }}:${DOCKER_TAG}-postgres" >> $GITHUB_OUTPUT |
| 260 | +
|
| 261 | + - name: Tag and push Docker image |
| 262 | + if: steps.docker-tag.outputs.tag != '' |
| 263 | + run: | |
| 264 | + docker tag app:build ${{ steps.docker-tag.outputs.full_tag }} |
| 265 | + docker images |
| 266 | + docker push ${{ steps.docker-tag.outputs.full_tag }} |
0 commit comments