| 1 |
name: Check dist/ |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- main |
| 7 |
paths-ignore: |
| 8 |
- '**.md' |
| 9 |
pull_request: |
| 10 |
paths-ignore: |
| 11 |
- '**.md' |
| 12 |
|
| 13 |
jobs: |
| 14 |
check-dist: |
| 15 |
runs-on: ubuntu-latest |
| 16 |
|
| 17 |
steps: |
| 18 |
- uses: actions/checkout@v3 |
| 19 |
|
| 20 |
- name: Set Node.js 16.x |
| 21 |
uses: actions/setup-node@v3 |
| 22 |
with: |
| 23 |
node-version: 16.x |
| 24 |
cache: npm |
| 25 |
|
| 26 |
- name: Install dependencies |
| 27 |
run: npm ci |
| 28 |
|
| 29 |
- name: Rebuild the dist/ directory |
| 30 |
run: | |
| 31 |
npm run build:compile |
| 32 |
npm run build:package |
| 33 |
|
| 34 |
- name: Compare the expected and actual dist/ directories |
| 35 |
run: | |
| 36 |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then |
| 37 |
echo "Detected uncommitted changes after build. See status below:" |
| 38 |
git diff |
| 39 |
exit 1 |
| 40 |
fi |
| 41 |
id: diff |
| 42 |
|
| 43 |
# If index.js was different than expected, upload the expected version as an artifact |
| 44 |
- uses: actions/upload-artifact@v3 |
| 45 |
if: ${{ failure() && steps.diff.conclusion == 'failure' }} |
| 46 |
with: |
| 47 |
name: dist |
| 48 |
path: dist/ |
| 49 |
|
| 50 |
# From https://github.com/actions/add-to-project/blob/main/.github/workflows/check-dist.yml |
| 51 |
|