update-catalogs #27
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: Update Catalogs | |
| on: | |
| workflow_dispatch: | |
| repository_dispatch: | |
| types: [update-catalogs] | |
| permissions: read-all | |
| defaults: | |
| run: | |
| shell: "bash -Eeuo pipefail -x {0}" | |
| jobs: | |
| update-catalogs: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | |
| with: | |
| token: ${{ secrets.REPO_GHA_PAT }} | |
| - name: Gather supported distributions and imageTypes | |
| id: get_env | |
| run: | | |
| DISTROS=$(sed -n '/variable "distributions"/,/}/ { s/^[[:space:]]*"\([^"]*\)".*/\1/p }' docker-bake.hcl | paste -sd, -) | |
| IMAGE_TYPES=$(sed -n '/variable "imageTypes"/,/}/ { s/^[[:space:]]*"\([^"]*\)".*/\1/p }' docker-bake.hcl | paste -sd, -) | |
| echo "distributions=$DISTROS" >> "$GITHUB_OUTPUT" | |
| echo "image_types=$IMAGE_TYPES" >> "$GITHUB_OUTPUT" | |
| - name: Generate catalogs | |
| uses: cloudnative-pg/postgres-containers/.github/actions/generate-catalogs@main | |
| with: | |
| output-dir: image-catalogs/ | |
| registry: ghcr.io/cloudnative-pg/postgis | |
| family: postgis | |
| distributions: ${{ steps.get_env.outputs.distributions }} | |
| image-types: ${{ steps.get_env.outputs.image_types }} | |
| regex: '(\d+)(?:\.\d+|beta\d+|rc\d+|alpha\d+)-(\d+(?:\.\d+){1,3})-(\d{12})' | |
| - name: Diff | |
| run: | | |
| git add -A . | |
| git status | |
| git diff --staged | |
| - name: Temporarily disable "include administrators" branch protection | |
| if: ${{ always() && github.ref == 'refs/heads/main' }} | |
| id: disable_include_admins | |
| uses: benjefferies/branch-protection-bot@af281f37de86139d1c7a27b91176b5dc1c2c827c # v1.1.2 | |
| with: | |
| access_token: ${{ secrets.REPO_GHA_PAT }} | |
| branch: main | |
| enforce_admins: false | |
| - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9 | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| with: | |
| add: 'image-catalogs/*.yaml' | |
| author_name: CloudNativePG Automated Updates | |
| author_email: noreply@cnpg.com | |
| message: 'chore: update imageCatalogs' | |
| - name: Enable "include administrators" branch protection | |
| uses: benjefferies/branch-protection-bot@af281f37de86139d1c7a27b91176b5dc1c2c827c # v1.1.2 | |
| if: ${{ always() && github.ref == 'refs/heads/main' }} | |
| with: | |
| access_token: ${{ secrets.REPO_GHA_PAT }} | |
| branch: main | |
| enforce_admins: ${{ steps.disable_include_admins.outputs.initial_status }} |