Skip to content

Auto Update

Auto Update #79

Workflow file for this run

name: Auto Update
on: # zizmor: ignore[concurrency-limits]
schedule:
- cron: '0 9 * * *' # Every day at 9am
workflow_dispatch:
permissions: {}
jobs:
auto_update: # zizmor: ignore[anonymous-definition]
runs-on: ubuntu-latest
name: Auto Update
permissions:
contents: read
steps:
- name: Generate App Token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
id: app-token
with:
app-id: ${{ secrets.AUTO_UPDATE_APP_ID }}
private-key: ${{ secrets.AUTO_UPDATE_APP_PRIVATE_KEY }}
permission-contents: write
permission-pull-requests: write
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # v2
with:
php-version: 8.4
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate key
run: php artisan key:generate
- name: Get Current Statamic Version
id: current-statamic-version
run: echo "statamic_version=$(composer show statamic/cms | grep 'versions' | grep -o -E '\* .+' | cut -d' ' -f2 | cut -d',' -f1)" >> "$GITHUB_OUTPUT"
- name: Update Dependencies
run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Get Updated Statamic Version
id: updated-statamic-version
run: echo "statamic_version=$(composer show statamic/cms | grep 'versions' | grep -o -E '\* .+' | cut -d' ' -f2 | cut -d',' -f1)" >> "$GITHUB_OUTPUT"
- name: Verify Changed Files
id: verify-changed-files
run: |
if git diff --quiet -- composer.json composer.lock && [ -z "$(git status --porcelain public/vendor)" ]; then
echo "files_changed=false" >> "$GITHUB_OUTPUT"
else
echo "files_changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Open a Pull Request # zizmor: ignore[superfluous-actions]
if: steps.verify-changed-files.outputs.files_changed == 'true' && steps.current-statamic-version.outputs.statamic_version != steps.updated-statamic-version.outputs.statamic_version
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
token: ${{ steps.app-token.outputs.token }}
commit-message: "Statamic ${{ steps.updated-statamic-version.outputs.statamic_version }}"
title: "Statamic ${{ steps.updated-statamic-version.outputs.statamic_version }}"
body: "This pull request updates this site to [Statamic ${{ steps.updated-statamic-version.outputs.statamic_version }}](https://github.com/statamic/cms/releases/${{ steps.updated-statamic-version.outputs.statamic_version }}) as well as any additional dependencies."
branch: "auto-update-statamic"
base: main