Change to node 20 (#12) #26
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: "👀 Test" | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: ["opened", "synchronize"] | |
paths-ignore: | |
- "**.md" | |
push: | |
branches: | |
- "main" | |
- "releases/*" | |
paths-ignore: | |
- "**.md" | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: "Test" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Setup node" | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: "Install dependencies" | |
run: npm ci | |
- name: "Rebuild the index.js file" | |
run: npm run build | |
- name: "Format check" | |
run: npm run format-check | |
- name: Audit npm for vulnerabilities | |
run: npm shrinkwrap && npm audit | |
- name: "Lint check" | |
run: npm run lint | |
- name: "Package" | |
run: npm run package | |
- name: "Test package" | |
run: npm test | |
- name: "Verify changes" | |
id: diff | |
run: | | |
if [ "$(git diff --diff-algorithm=minimal --ignore-cr-at-eol --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then | |
echo "::warning::Detected uncommitted changes after build." | |
echo "::warning::Remember to run 'npm run all' to update 'dist/index.js' and include it in the commit." | |
git status | |
git diff --diff-algorithm=minimal --ignore-cr-at-eol --ignore-space-at-eol --exit-code | |
else | |
echo "No changes detected" | |
fi | |
- name: "Upload dist if failure" | |
uses: actions/upload-artifact@v3 | |
if: failure() && steps.diff.conclusion == 'failure' | |
with: | |
name: dist | |
path: dist/ |