fix for CI script #44
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: CI | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: π οΈ Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: π Clear Cache | |
run: npm run clean | |
- name: π Ensure package-lock.json is up-to-date | |
run: npm install --package-lock-only --ignore-scripts --legacy-peer-deps | |
- name: π¦ Install dependencies | |
run: npm ci --legacy-peer-deps | |
- name: πΆ Set up Husky | |
run: npx husky install | |
- name: ποΈ Format code | |
run: npm run format | |
- name: π§Ή Lint code | |
run: npm run lint | |
- name: π Generate test files | |
run: npm run generate-tests | |
- name: ποΈ Format generated test files | |
run: npm run format | |
- name: π¨ Build | |
run: npm run build | |
- name: π§ͺ Test with coverage | |
run: npm run test | |
- name: π€ Commit and push all changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
if ! git diff --quiet; then | |
git add -A | |
git commit -m 'π€ Auto-commit changes from CI' | |
git push | |
else | |
echo "No changes detected. Skipping commit." | |
fi | |
shell: /usr/bin/bash -e {0} | |
# Deploy build to GitHub Pages | |
- name: π Deploy dist to GitHub Pages | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist | |
publish_branch: gh-pages |