Bump Dependencies #17
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: 'Bump Dependencies' | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
update-deps: | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🗂 Checkout Code | |
uses: actions/checkout@v4 | |
- name: 🧩 Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22.x' | |
- name: 📦 Install PNPM | |
run: npm i pnpm -g | |
- name: 🗃 Setup Cache Environment | |
id: extcache | |
uses: shivammathur/cache-extensions@v1 | |
with: | |
php-version: 8.2 | |
extensions: bcmath | |
key: php_extensions_cache | |
- name: 🗃 Cache Extensions | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.extcache.outputs.dir }} | |
key: ${{ steps.extcache.outputs.key }} | |
restore-keys: ${{ steps.extcache.outputs.key }} | |
- name: 🐘 Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
extensions: bcmath | |
- name: 🗄 Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: 🗃 Cache Composer Dependencies | |
uses: actions/cache@v4 | |
id: actions-cache | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: 🗂 Cache PHP Dependencies | |
uses: actions/cache@v4 | |
id: vendor-cache | |
with: | |
path: vendor | |
key: ${{ runner.OS }}-vendor-${{ hashFiles('**/composer.lock') }} | |
- name: 🚀 Bump and Install Dependencies | |
run: | | |
chmod +x ./.scripts/local/bump.sh | |
./.scripts/local/bump.sh | |
shell: bash | |
- name: 🏗 Build Frontend with Vite | |
run: pnpm build | |
- name: Set up Git user | |
run: | | |
git config --global user.name "${{ github.actor }}-ci-automation" | |
git config --global user.email "${{ env.GITHUB_GIT_EMAIL }}" | |
- name: Make changes and commit | |
run: | | |
DATE=$(date +'%Y-%m-%d') | |
BRANCH_NAME="bump/deps-${DATE}" | |
git checkout -b "$BRANCH_NAME" | |
git add . | |
git commit -m "Automated update on ${DATE}" | |
- name: Push changes to a new branch | |
run: git push origin "$BRANCH_NAME" | |
- name: Create a Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: '$BRANCH_NAME' | |
base: dev | |
title: 'Automated Dependency Update on ${DATE}' | |
body: 'This pull request has been automatically created by GitHub Actions.' |