Automatic Updates #2057
This file contains 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: Automatic Updates | |
on: | |
schedule: | |
- cron: 0 0 * * * | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: 'bash -Eeuo pipefail -x {0}' | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.REPO_GHA_PAT }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Update docker-entrypoint | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_seconds: 20 | |
max_attempts: 3 | |
command: | | |
echo "Updating UBI docker-entrypoint" | |
curl -fsSo ./UBI/src/root/usr/local/bin/docker-entrypoint.sh https://raw.githubusercontent.com/docker-library/postgres/master/docker-entrypoint.sh | |
- name: Run update script | |
uses: nick-fields/retry@v3 | |
env: | |
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} | |
with: | |
timeout_minutes: 15 | |
max_attempts: 3 | |
command: | | |
# pip-tools provides pip-compile used by update.sh | |
export PATH=$HOME/.local/bin:$PATH | |
pip3 install --upgrade pip-tools cloudsmith-cli pip | |
echo "Updating UBI images" | |
./UBI/update.sh | |
- name: Diff | |
run: | | |
git status | |
git diff | |
- name: Temporarily disable "include administrators" branch protection | |
if: ${{ always() && github.ref == 'refs/heads/main' }} | |
id: disable_include_admins | |
uses: benjefferies/[email protected] | |
with: | |
access_token: ${{ secrets.REPO_GHA_PAT }} | |
branch: main | |
enforce_admins: false | |
- uses: EndBug/add-and-commit@v9 | |
with: | |
author_name: EnterpriseDB Automated Updates | |
author_email: [email protected] | |
message: 'Daily automatic update' | |
- name: Enable "include administrators" branch protection | |
uses: benjefferies/[email protected] | |
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 }} | |
- name: Slack Notification | |
uses: rtCamp/action-slack-notify@v2 | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
env: | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_ICON: https://avatars.githubusercontent.com/u/44036562?size=48 | |
SLACK_USERNAME: ghBot | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_MESSAGE: Failure updating PostgreSQL images |