feat: add improvements for ci and packaging #1
Workflow file for this run
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: Check dist/ | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '**.md' | |
| pull_request: | |
| paths-ignore: | |
| - '**.md' | |
| workflow_dispatch: | |
| jobs: | |
| check-dist: | |
| name: Check dist/ | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .node-version | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build dist/ | |
| run: npm run build | |
| - name: Compare expected and actual dist/ directories | |
| run: | | |
| if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then | |
| echo "Detected uncommitted changes after build. See status below:" | |
| git diff --ignore-space-at-eol --text dist/ | |
| exit 1 | |
| fi | |
| id: diff | |
| - name: Upload artifact | |
| if: ${{ failure() && steps.diff.conclusion == 'failure' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Fail if dist/ is out of sync | |
| if: ${{ failure() && steps.diff.conclusion == 'failure' }} | |
| run: | | |
| echo "::error::The dist/ directory is out of sync with the source code. Run 'npm run build' and commit the changes." | |
| exit 1 |