|
| 1 | +name: Update Catalogs |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + workflow_dispatch: |
| 6 | + repository_dispatch: |
| 7 | + types: [update-catalogs] |
| 8 | + |
| 9 | +permissions: read-all |
| 10 | + |
| 11 | +defaults: |
| 12 | + run: |
| 13 | + shell: "bash -Eeuo pipefail -x {0}" |
| 14 | + |
| 15 | +jobs: |
| 16 | + update-catalogs: |
| 17 | + runs-on: ubuntu-24.04 |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 |
| 21 | + with: |
| 22 | + token: ${{ secrets.REPO_GHA_PAT }} |
| 23 | + |
| 24 | + - name: Gather supported distributions and imageTypes |
| 25 | + id: get_env |
| 26 | + run: | |
| 27 | + DISTROS=$(sed -n '/variable "distributions"/,/}/ { s/^[[:space:]]*"\([^"]*\)".*/\1/p }' docker-bake.hcl | paste -sd, -) |
| 28 | + IMAGE_TYPES=$(sed -n '/variable "imageTypes"/,/}/ { s/^[[:space:]]*"\([^"]*\)".*/\1/p }' docker-bake.hcl | paste -sd, -) |
| 29 | + echo "distributions=$DISTROS" >> "$GITHUB_OUTPUT" |
| 30 | + echo "image_types=$IMAGE_TYPES" >> "$GITHUB_OUTPUT" |
| 31 | +
|
| 32 | + - name: Generate catalogs |
| 33 | + uses: cloudnative-pg/postgres-containers/.github/actions/generate-catalogs@dev/100 |
| 34 | + with: |
| 35 | + output-dir: image-catalogs/ |
| 36 | + registry: ghcr.io/cloudnative-pg/postgis-testing |
| 37 | + distributions: ${{ steps.get_env.outputs.distributions }} |
| 38 | + image-types: ${{ steps.get_env.outputs.image_types }} |
| 39 | + regex: '(\d+)(?:\.\d+|beta\d+|rc\d+|alpha\d+)-(\d+(?:\.\d+){1,3})-(\d{12})' |
| 40 | + |
| 41 | + - name: Diff |
| 42 | + run: | |
| 43 | + git add -A . |
| 44 | + git status |
| 45 | + git diff --staged |
| 46 | +
|
| 47 | + - name: Temporarily disable "include administrators" branch protection |
| 48 | + if: ${{ always() && github.ref == 'refs/heads/main' }} |
| 49 | + id: disable_include_admins |
| 50 | + uses: benjefferies/branch-protection-bot@af281f37de86139d1c7a27b91176b5dc1c2c827c # v1.1.2 |
| 51 | + with: |
| 52 | + access_token: ${{ secrets.REPO_GHA_PAT }} |
| 53 | + branch: main |
| 54 | + enforce_admins: false |
| 55 | + |
| 56 | + - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9 |
| 57 | + if: ${{ github.ref == 'refs/heads/main' }} |
| 58 | + with: |
| 59 | + add: 'image-catalogs/*.yaml' |
| 60 | + author_name: CloudNativePG Automated Updates |
| 61 | + author_email: noreply@cnpg.com |
| 62 | + message: 'chore: update imageCatalogs' |
| 63 | + |
| 64 | + - name: Enable "include administrators" branch protection |
| 65 | + uses: benjefferies/branch-protection-bot@af281f37de86139d1c7a27b91176b5dc1c2c827c # v1.1.2 |
| 66 | + if: ${{ always() && github.ref == 'refs/heads/main' }} |
| 67 | + with: |
| 68 | + access_token: ${{ secrets.REPO_GHA_PAT }} |
| 69 | + branch: main |
| 70 | + enforce_admins: ${{ steps.disable_include_admins.outputs.initial_status }} |
0 commit comments