|
| 1 | +name: Update PostgreSQL versions |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: 0 0 * * 1 |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +defaults: |
| 9 | + run: |
| 10 | + shell: 'bash -Eeuo pipefail -x {0}' |
| 11 | + |
| 12 | +permissions: read-all |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + name: Run update script |
| 17 | + runs-on: ubuntu-24.04 |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 |
| 20 | + with: |
| 21 | + token: ${{ secrets.REPO_GHA_PAT }} |
| 22 | + |
| 23 | + - name: Run update script |
| 24 | + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 |
| 25 | + with: |
| 26 | + timeout_minutes: 15 |
| 27 | + max_attempts: 3 |
| 28 | + command: | |
| 29 | + VERSIONS="$( |
| 30 | + curl -Ss -q https://www.postgresql.org/versions.json \ |
| 31 | + | jq -r '[.[] | select(.supported == true) | .major + "." + .latestMinor] |
| 32 | + | sort |
| 33 | + | map(" \"" + . + "\"") |
| 34 | + | join(",\n")' \ |
| 35 | + | sed '1i postgreSQLVersions = [' \ |
| 36 | + | sed '$a ]' |
| 37 | + )" |
| 38 | + printf '%s\n' "$VERSIONS" \ |
| 39 | + | sed -i '/^postgreSQLVersions = \[/,/^]/d;/^\/\/ PostgreSQL versions/r /dev/stdin' docker-bake.hcl |
| 40 | +
|
| 41 | + - name: Diff |
| 42 | + run: | |
| 43 | + git status |
| 44 | + git diff |
| 45 | +
|
| 46 | + - name: Temporarily disable "include administrators" branch protection |
| 47 | + if: ${{ always() && github.ref == 'refs/heads/main' }} |
| 48 | + id: disable_include_admins |
| 49 | + uses: benjefferies/branch-protection-bot@af281f37de86139d1c7a27b91176b5dc1c2c827c # v1.1.2 |
| 50 | + with: |
| 51 | + access_token: ${{ secrets.REPO_GHA_PAT }} |
| 52 | + branch: main |
| 53 | + enforce_admins: false |
| 54 | + |
| 55 | + - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9 |
| 56 | + with: |
| 57 | + author_name: CloudNativePG Automated Updates |
| 58 | + |
| 59 | + message: 'chore: update PostgreSQL versions' |
| 60 | + |
| 61 | + - name: Enable "include administrators" branch protection |
| 62 | + uses: benjefferies/branch-protection-bot@af281f37de86139d1c7a27b91176b5dc1c2c827c # v1.1.2 |
| 63 | + if: ${{ always() && github.ref == 'refs/heads/main' }} |
| 64 | + with: |
| 65 | + access_token: ${{ secrets.REPO_GHA_PAT }} |
| 66 | + branch: main |
| 67 | + enforce_admins: ${{ steps.disable_include_admins.outputs.initial_status }} |
0 commit comments