Bump Dependencies #34
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: 🌿 Create a new branch | |
run: | | |
NEW_BRANCH="update/bump-dependency-versions-$(date +'%d-%m-%Y')" | |
git checkout -b "$NEW_BRANCH" | |
echo "::set-output name=new_branch::$NEW_BRANCH" | |
- name: 🔍 Check for changes and commit | |
run: | | |
git diff --quiet || git commit -am "Update dependencies" | |
- name: 🚀 Push changes | |
if: success() | |
run: git push origin ${{ steps.create_branch.outputs.new_branch }} | |
- name: 🔀 Create Pull Request | |
uses: repo-sync/pull-request@v2 | |
with: | |
source_branch: ${{ steps.create-branch.outputs.NEW_BRANCH }} | |
destination_branch: main | |
pr_title: 'Bump dependencies' | |
pr_body: 'This PR updates the project dependencies.' |