Skip to content

update

update #523

Workflow file for this run

name: update
on:
workflow_run:
workflows: ["tests"]
types:
- completed
branches:
- main
schedule:
- cron: "0 12 */5 * *"
workflow_dispatch:
jobs:
updates:
name: Check for updates
runs-on: ubuntu-latest
if: ${{ github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'main') }}
# Map a step output to a job output
outputs:
updates: ${{ steps.check-updates.outputs.updates }}
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: Homebrew/actions/setup-homebrew@main
- run: brew install ddev/ddev/ddev >/dev/null
- uses: actions/checkout@v4
- name: 'Run updates'
run: |
./update.sh
- name: Check if something was updated
id: check-updates
run: |
if [[ `git status --porcelain` ]]; then
git diff > /tmp/updates.patch
echo "updates=true" >> "$GITHUB_OUTPUT"
else
echo "updates=false" >> "$GITHUB_OUTPUT"
fi
- uses: actions/upload-artifact@v4
if: steps.check-updates.outputs.updates == 'true'
with:
name: patch
path: /tmp/updates.patch
if-no-files-found: error
tests:
name: Test the updates
runs-on: ubuntu-latest
needs: updates
if: needs.updates.outputs.updates == 'true'
strategy:
matrix:
ddev_version: [stable, HEAD]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: patch
path: /tmp
- run: git apply /tmp/updates.patch
- uses: ddev/github-action-add-on-test@v2
with:
ddev_version: ${{ matrix.ddev_version }}
token: ${{ secrets.GITHUB_TOKEN }}
debug_enabled: ${{ github.event.inputs.debug_enabled }}
addon_repository: ${{ env.GITHUB_REPOSITORY }}
addon_ref: ${{ env.GITHUB_REF }}
disable_checkout_action: true
commitpush:
name: Commit and push the updates
runs-on: ubuntu-latest
needs: tests
if: needs.updates.outputs.updates == 'true'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: patch
path: /tmp
- run: git apply /tmp/updates.patch
- name: 'Commit changes'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "build: automatic update.sh updates (GA)"
git pull --rebase
git push
slack:
runs-on: ubuntu-latest
needs: [updates, tests, commitpush]
if: ${{ failure() }}
name: Slack Notification
steps:
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
SLACK_ICON: https://ca.slack-edge.com/T01Q8N63GKV-U021BBD8TUL-b005c7c0d607-72
SLACK_USERNAME: ddev-pimp-my-shell
MSG_MINIMAL: true
SLACK_COLOR: failure
SLACK_MESSAGE: Error updating dependencies <!here>