Skip to content

Automatic Update #15712

Automatic Update

Automatic Update #15712

Workflow file for this run

name: Automatic Update
on:
workflow_dispatch:
schedule:
- cron: '0 * * * *'
jobs:
update:
runs-on: ubuntu-latest
outputs:
update-time: ${{ steps.update.outputs.update-time }}
manifest: ${{ steps.update.outputs.manifest }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: 3.11
- name: Install dependencies
working-directory: ./updater
run: pdm install
- name: Update manifest
id: update
working-directory: ./updater
run: |
update_time=$(date --utc --iso-8601=seconds)
echo "update-time=$update_time" >> $GITHUB_OUTPUT
pdm run updater \
--update-time $update_time \
--manifest ../manifest.json \
--summary ../summary.md \
13 14 15 16
manifest=$(cat ../manifest.json | jq -c)
echo "manifest=$manifest" >> $GITHUB_OUTPUT
cat ../summary.md >> $GITHUB_STEP_SUMMARY
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Automatic Update
file_pattern: manifest.json
build:
strategy:
matrix:
postgresql-version: ["13", "14", "15", "16"]
runs-on: ubuntu-latest
needs: update
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Read manifest
id: manifest
run: |
wal2json_tag=$( \
echo '${{ needs.update.outputs.manifest }}' \
| jq -r '.wal2json.upstream_tag' \
)
postgresql_manifest=$( \
echo '${{ needs.update.outputs.manifest }}' \
| jq -c '.postgresql[] | select(.major_version == "${{ matrix.postgresql-version }}")' \
)
postgresql_updated=$( \
echo $postgresql_manifest \
| jq \
--arg update_time ${{ needs.update.outputs.update-time }} \
'.last_updated == $update_time' \
)
postgresql_tag=$( \
echo $postgresql_manifest \
| jq -r '.upstream_tag' \
)
tags=$( \
echo $postgresql_manifest \
| jq -r '.tags | join(",")' \
)
echo "wal2json-tag=$wal2json_tag" >> $GITHUB_OUTPUT
echo "postgresql-tag=$postgresql_tag" >> $GITHUB_OUTPUT
echo "updated=$postgresql_updated" >> $GITHUB_OUTPUT
echo "tags=$tags" >> $GITHUB_OUTPUT
- name: Set up QEMU
if: steps.manifest.outputs.updated == 'true'
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: steps.manifest.outputs.updated == 'true'
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: steps.manifest.outputs.updated == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
if: steps.manifest.outputs.updated == 'true'
uses: docker/build-push-action@v5
with:
push: ${{ github.event_name != 'pull_request' }}
context: .
tags: ${{ steps.manifest.outputs.tags }}
build-args: |
POSTGRESQL_TAG=${{ steps.manifest.outputs.postgresql-tag }}
WAL2JSON_TAG=${{ steps.manifest.outputs.wal2json-tag }}