Update Dependencies #34
This file contains hidden or 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: Update Dependencies | |
| on: | |
| schedule: | |
| # Run daily at 6am UTC | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: # Allow manual trigger | |
| permissions: | |
| contents: write | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| extensions: dom, curl, libxml, mbstring, zip | |
| coverage: none | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Configure Composer Auth | |
| run: | | |
| composer config --global http-basic.nativephp.composer.sh "${{ secrets.NATIVEPHP_LICENSE_EMAIL }}" "${{ secrets.NATIVEPHP_LICENSE_KEY }}" | |
| - name: Update Composer Dependencies | |
| run: composer update --no-interaction --no-progress | |
| - name: Update NPM Dependencies | |
| run: npm update | |
| - name: Rebuild Frontend Assets | |
| run: npm run build | |
| - name: Check for Changes | |
| id: changes | |
| run: | | |
| if git diff --quiet composer.lock package-lock.json; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and Push | |
| if: steps.changes.outputs.changed == 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add composer.lock package-lock.json | |
| git commit -m "Update dependencies | |
| Automated daily dependency update: | |
| - composer update | |
| - npm update" | |
| git push |