Skip to content

refactor(changset): 💡 introduce cache, order steps #6

refactor(changset): 💡 introduce cache, order steps

refactor(changset): 💡 introduce cache, order steps #6

name: 🪡 Changeset
on:
push:
branches:
- develop
jobs:
changeset_handler:
name: Changeset handler
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 7
run_install: false
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: |
pnpm install \
--strict-peer-dependencies
- name: Set version
run: |
pnpm changeset:version
git status --short
- name: Commit changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if ! git add -A; then
echo "👹 Oops! Failed stage changes"
exit 1
fi
echo "✅ Staged all changes!"
if ! git commit \
--allow-empty \
--no-verify \
-m "chore: 🤖 updated package version"; then
echo "👹 Oops! Failed to commit package version."
exit 1
fi
echo "✅ Committed package version!"
if ! git push; then
echo "👹 Oops! Failed to push changes."
exit 1
fi
echo "✅ Pushed changes to repository!"