add missing steps again #143
This file contains hidden or 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: deploy-image | ||
|
Check failure on line 1 in .github/workflows/deploy-image.yaml
|
||
| on: | ||
| workflow_dispatch: | ||
| workflow_run: | ||
| workflows: | ||
| - build-latest | ||
| branches: | ||
| - develop | ||
| types: | ||
| - completed | ||
| permissions: | ||
| contents: read | ||
| env: | ||
| IMAGE_NAME: ${{ secrets.DOCKERHUB_REPO }}/postgis | ||
| jobs: | ||
| build-local-image: | ||
| runs-on: ubuntu-latest | ||
| if: | | ||
| github.actor != 'dependabot[bot]' && | ||
| !( | ||
| contains(github.event.pull_request.title, '[skip-release]') || | ||
| contains(github.event.comment.body, '/skiprelease') | ||
| ) && | ||
| github.event.workflow_run.conclusion == 'success' | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| postgresMajorVersion: | ||
| - 18 | ||
| postgisMajorVersion: | ||
| - 3 | ||
| postgisMinorRelease: | ||
| - 6 | ||
| postgisPatchMajorVersionBugs: | ||
| - no | ||
| imageVersion: | ||
| - imageDistro: debian | ||
| imageDistroVersion: trixie | ||
| imageDistroVariant: slim | ||
| outputs: | ||
| pg_ver: ${{ steps.pg_versions.outputs.PG_VER }} | ||
| gis_ver: ${{ steps.pg_versions.outputs.GIS_VER }} | ||
| generic_missing: ${{ steps.check_generic.outputs.generic_missing }} | ||
| exact_missing: ${{ steps.check_exact.outputs.exact_missing }} | ||
| current_date: ${{ steps.current_date.outputs.formatted }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v4 | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v4 | ||
| - name: Build local metadata image | ||
| uses: docker/build-push-action@v7 | ||
| with: | ||
| context: . | ||
| file: Dockerfile | ||
| load: true | ||
| tags: kartoza/postgis:prod-build | ||
| build-args: | | ||
| DISTRO=${{ matrix.imageVersion.imageDistro }} | ||
| IMAGE_VERSION=${{ matrix.imageVersion.imageDistroVersion }} | ||
| IMAGE_VARIANT=${{ matrix.imageVersion.imageDistroVariant }} | ||
| GENERATE_ALL_LOCALE=0 | ||
| POSTGRES_MAJOR_VERSION=${{ matrix.postgresMajorVersion }} | ||
| POSTGIS_MAJOR_VERSION=${{ matrix.postgisMajorVersion }} | ||
| POSTGIS_MINOR_VERSION=${{ matrix.postgisMinorRelease }} | ||
| BUILD_PG_DUCKDB=false | ||
| target: postgis-prod | ||
| - name: Extract package versions | ||
| id: pg_versions | ||
| run: | | ||
| CONTAINER_NAME=postgis-version-check | ||
| POSTGIS_TEST_IMAGE=kartoza/postgis:prod-build | ||
| docker run -d \ | ||
| --name ${CONTAINER_NAME} \ | ||
| ${POSTGIS_TEST_IMAGE} | ||
| PG_VER=$(docker exec ${CONTAINER_NAME} bash -c \ | ||
| "apt-cache policy postgresql-${{ matrix.postgresMajorVersion }} \ | ||
| | awk '/Candidate:/ {print \$2}' \ | ||
| | sed 's/-.*//'") | ||
| GIS_VER=$(docker exec ${CONTAINER_NAME} bash -c \ | ||
| "apt-cache policy postgresql-${{ matrix.postgresMajorVersion }}-postgis-${{ matrix.postgisMajorVersion }} \ | ||
| | awk '/Candidate:/ {print \$2}' \ | ||
| | sed 's/+.*//' \ | ||
| | sed 's/-.*//'") | ||
| docker stop ${CONTAINER_NAME} | ||
| docker rm ${CONTAINER_NAME} | ||
| echo "PG_VER=${PG_VER}" >> $GITHUB_OUTPUT | ||
| echo "GIS_VER=${GIS_VER}" >> $GITHUB_OUTPUT | ||
| - name: Check generic tag | ||
| id: check_generic | ||
| run: | | ||
| STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ | ||
| https://hub.docker.com/v2/repositories/${{ secrets.DOCKERHUB_REPO }}/postgis/tags/${{ matrix.postgresMajorVersion }}-${{ matrix.postgisMajorVersion }}.${{ matrix.postgisMinorRelease }}/) | ||
| if [ "$STATUS" = "404" ]; then | ||
| echo "generic_missing=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "generic_missing=false" >> $GITHUB_OUTPUT | ||
| fi | ||
| - name: Check exact tag | ||
| id: check_exact | ||
| run: | | ||
| STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ | ||
| https://hub.docker.com/v2/repositories/${{ secrets.DOCKERHUB_REPO }}/postgis/tags/${{ steps.pg_versions.outputs.PG_VER }}-${{ steps.pg_versions.outputs.GIS_VER }}/) | ||
| if [ "$STATUS" = "404" ]; then | ||
| echo "exact_missing=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "exact_missing=false" >> $GITHUB_OUTPUT | ||
| fi | ||
| - name: Current date | ||
| id: current_date | ||
| run: | | ||
| echo "formatted=$(date -u +%Y.%m.%d)" >> $GITHUB_OUTPUT | ||
| build-platform-images: | ||
| runs-on: ubuntu-latest | ||
| needs: [build-local-image] | ||
| if: | | ||
| github.actor != 'dependabot[bot]' && | ||
| !( | ||
| contains(github.event.pull_request.title, '[skip-release]') || | ||
| contains(github.event.comment.body, '/skiprelease') | ||
| ) && github.event.workflow_run.conclusion == 'success' | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| postgresMajorVersion: | ||
| - 18 | ||
| postgisMajorVersion: | ||
| - 3 | ||
| postgisMinorRelease: | ||
| - 6 | ||
| imageVersion: | ||
| - imageDistro: debian | ||
| imageDistroVersion: trixie | ||
| imageDistroVariant: slim | ||
| include: | ||
| - platform: linux/amd64 | ||
| arch: amd64 | ||
| - platform: linux/arm64 | ||
| arch: arm64 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v4 | ||
| - name: Login to DockerHub | ||
| uses: docker/login-action@v4 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
| - name: Build and push | ||
| id: build | ||
| uses: docker/build-push-action@v7 | ||
| with: | ||
| context: . | ||
| file: Dockerfile | ||
| platforms: ${{ matrix.platform }} | ||
| provenance: false | ||
| outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true | ||
| build-args: | | ||
| DISTRO=${{ matrix.imageVersion.imageDistro }} | ||
| IMAGE_VERSION=${{ matrix.imageVersion.imageDistroVersion }} | ||
| IMAGE_VARIANT=${{ matrix.imageVersion.imageDistroVariant }} | ||
| GENERATE_ALL_LOCALE=1 | ||
| POSTGRES_MAJOR_VERSION=${{ matrix.postgresMajorVersion }} | ||
| POSTGIS_MAJOR_VERSION=${{ matrix.postgisMajorVersion }} | ||
| POSTGIS_MINOR_VERSION=${{ matrix.postgisMinorRelease }} | ||
| BUILD_PG_DUCKDB=false | ||
| cache-from: | | ||
| type=gha,scope=${{ matrix.arch }} | ||
| cache-to: | | ||
| type=gha,mode=max,scope=${{ matrix.arch }} | ||
| - name: Export digest | ||
| run: | | ||
| mkdir -p /tmp/digests | ||
| digest="${{ steps.build.outputs.digest }}" | ||
| touch "/tmp/digests/${digest#sha256:}" | ||
| - name: Upload digest | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: digests-${{ matrix.arch }} | ||
| path: /tmp/digests/* | ||
| if-no-files-found: error | ||
| retention-days: 1 | ||
| create-manifests: | ||
| runs-on: ubuntu-latest | ||
| needs: [ build-local-image, build-platform-images] | ||
| if: | | ||
| github.actor != 'dependabot[bot]' && | ||
| !( | ||
| contains(github.event.pull_request.title, '[skip-release]') || | ||
| contains(github.event.comment.body, '/skiprelease') | ||
| ) && github.event.workflow_run.conclusion == 'success' | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| postgresMajorVersion: | ||
| - 18 | ||
| postgisMajorVersion: | ||
| - 3 | ||
| postgisMinorRelease: | ||
| - 6 | ||
| steps: | ||
| - name: Download digests | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: /tmp/digests | ||
| pattern: digests-* | ||
| merge-multiple: true | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v4 | ||
| - name: Login to DockerHub | ||
| uses: docker/login-action@v4 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
| - name: Create latest manifest | ||
| working-directory: /tmp/digests | ||
| run: | | ||
| docker buildx imagetools create \ | ||
| -t ${{ env.IMAGE_NAME }}:latest \ | ||
| $(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *) | ||
| - name: Create generic manifest | ||
| if: | | ||
| needs.build-local-image.outputs.generic_missing == 'true' || matrix.postgisPatchMajorVersionBugs == 'yes' | ||
| working-directory: /tmp/digests | ||
| run: | | ||
| docker buildx imagetools create \ | ||
| -t ${{ env.IMAGE_NAME }}:${{ matrix.postgresMajorVersion }}-${{ matrix.postgisMajorVersion }}.${{ matrix.postgisMinorRelease }} \ | ||
| $(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *) | ||
| - name: Create exact manifest | ||
| if: | | ||
| needs.build-local-image.outputs.exact_missing == 'true' || matrix.postgisPatchMajorVersionBugs == 'y | ||
| working-directory: /tmp/digests | ||
| run: | | ||
| docker buildx imagetools create \ | ||
| -t ${{ env.IMAGE_NAME }}:${{ needs.build-local-image.outputs.pg_ver }}-${{ needs.build-local-image.outputs.gis_ver }} \ | ||
| $(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *) | ||
| - name: Create dated generic manifest | ||
| working-directory: /tmp/digests | ||
| run: | | ||
| docker buildx imagetools create \ | ||
| -t ${{ env.IMAGE_NAME }}:${{ matrix.postgresMajorVersion }}-${{ matrix.postgisMajorVersion }}.${{ matrix.postgisMinorRelease }}--v${{ needs.build-local-image.outputs.current_date }} \ | ||
| $(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *) | ||
| - name: Create dated exact manifest | ||
| working-directory: /tmp/digests | ||
| run: | | ||
| docker buildx imagetools create \ | ||
| -t ${{ env.IMAGE_NAME }}:${{ needs.build-local-image.outputs.pg_ver }}-${{ needs.build-local-image.outputs.gis_ver }}--v${{ needs.build-local-image.outputs.current_date }} \ | ||
| $(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *) | ||
| publish_release_artifacts: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| if: | | ||
| github.actor != 'dependabot[bot]' && | ||
| !( | ||
| contains(github.event.pull_request.title, '[skip-release]') || | ||
| contains(github.event.comment.body, '/skiprelease') | ||
| ) && github.event.workflow_run.conclusion == 'success' | ||
| needs: [create-manifests] | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| postgresMajorVersion: | ||
| - 18 | ||
| postgisMajorVersion: | ||
| - 3 | ||
| postgisMinorRelease: | ||
| - 6 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: 'develop' | ||
| - name: Get Current Date | ||
| id: current_date | ||
| run: echo "formatted=$(date -u +%Y.%m.%d)" >> $GITHUB_OUTPUT | ||
| - name: Get Latest Commit Hash | ||
| id: latest_commit_hash | ||
| run: echo "commit=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT | ||
| - name: Publish release | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| gh release create \ | ||
| v${{ matrix.postgresMajorVersion }}.${{ matrix.postgisMajorVersion }}.${{ matrix.postgisMinorRelease }}--v${{ steps.current_date.outputs.formatted }}--${{ steps.commit.outputs.sha }} \ | ||
| --notes "${{ steps.latest_commit_hash.outputs.commit }}" \ | ||
| --target develop \ | ||
| --repo $GITHUB_REPOSITORY | ||