Update project #1
This file contains hidden or 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: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test | |
| check-dist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build distribution | |
| run: npm run build | |
| - name: Compare distributions | |
| run: | | |
| if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then | |
| echo "::error::Detected uncommitted changes after build. Run 'npm run build' and commit the changes." | |
| git diff --text dist/ | |
| exit 1 | |
| fi | |
| - name: Verify action.yml points to dist | |
| run: | | |
| if ! grep -q "main: 'dist/index.mjs'" action.yml; then | |
| echo "::error::action.yml must point to dist/index.mjs" | |
| exit 1 | |
| fi |