Update Dependencies #25
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: Update Dependencies | |
on: | |
schedule: | |
- cron: '0 0 * * 1' | |
workflow_dispatch: | |
jobs: | |
update-dependencies: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Volta | |
run: | | |
curl https://get.volta.sh | bash | |
echo "$HOME/.volta/bin" >> $GITHUB_PATH | |
- name: Install Node.js with Volta | |
run: volta install node | |
- name: Set PNPM version | |
run: | | |
echo "PNPM_VERSION=$(jq -r '.packageManager' package.json | awk -F'@' '{print $2}')" >> $GITHUB_ENV | |
- name: Install pnpm using Volta | |
run: volta install pnpm@${{ env.PNPM_VERSION }} | |
- name: Get pnpm store directory | |
run: | | |
echo "PNPM_STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: Setup pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.PNPM_STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile --strict-peer-dependencies | |
- name: Update dependencies | |
run: pnpm up -r --latest '!*eslint*' | |
- name: Build | |
run: pnpm build | |
- name: Commit and push changes | |
if: success() | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add . | |
git diff-index --quiet HEAD || git commit -m "chore: update dependencies" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |