Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 49 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,52 +53,65 @@ jobs:
run: pnpm build

build-on-merge:
name: Build and Upload Artifacts
name: Build and Commit Artifacts
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: latest

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
- uses: actions/checkout@v4
with:
persist-credentials: true
fetch-depth: 0 # Required to push back to repo

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: latest

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-

- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Type check
run: pnpm type-check
- name: Type check
run: pnpm type-check

- name: Run tests with coverage
run: pnpm test:coverage
- name: Run tests with coverage
run: pnpm test:coverage

- name: Build
run: pnpm build
- name: Build
run: pnpm build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
dist/**
!**/node_modules/**
- name: Commit and push build files
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"

# Stage only the build output (adjust if necessary)
git add dist/

# Don't commit if nothing changed
if git diff --cached --quiet; then
echo "No changes to commit."
else
git commit -m "ci: commit build output [skip ci]"
git push origin main
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}