wrapper-validation-action/.github/workflows/check-dist.yml

52 lines
1.3 KiB
YAML
Raw Normal View History

2021-12-22 16:29:25 +00:00
# `dist/index.js` is a special file in Actions.
# When you reference an action with `uses:` in a workflow,
# `index.js` is the code that will run.
# For our project, we generate this file through a build process from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
2023-02-18 23:48:29 +00:00
name: Check dist directory
2021-12-22 16:29:25 +00:00
on:
push:
branches:
- main
2024-02-06 15:24:05 +00:00
- releases/**
2021-12-22 16:29:25 +00:00
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
check-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
2021-12-22 16:29:25 +00:00
- uses: actions/setup-node@v4
2021-12-22 16:29:25 +00:00
with:
node-version: 20
- name: Build
run: |
npm -v
node -v
npm install
npm run build
2021-12-22 16:29:25 +00:00
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
# If index.js was different than expected, upload the expected version as an artifact
2024-01-29 20:25:44 +00:00
- uses: actions/upload-artifact@v4
2021-12-22 16:29:25 +00:00
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/