Skip to content

Commit 3f3c975

Browse files
authored
Replace push dist/ with check dist/ (#256)
* Replace dist/ pushing with dist/ checking * Check that failure happens if dist is manually updated. * Revert "Check that failure happens if dist is manually updated." This reverts commit a181f3e. * Ignore github actions folder in codecov * Update check-dist.yml
1 parent a9a7eb4 commit 3f3c975

File tree

3 files changed

+77
-28
lines changed

3 files changed

+77
-28
lines changed

.github/workflows/check-dist.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# In JavaScript actions, `dist/` is a special directory. When you reference
2+
# an action with the `uses:` property, `dist/index.js` is the code that will be
3+
# run. For this project, the `dist/index.js` file is transpiled from other
4+
# source files. This workflow ensures the `dist/` directory contains the
5+
# expected transpiled code.
6+
#
7+
# If this workflow is run from a feature branch, it will act as an additional CI
8+
# check and fail if the checked-in `dist/` directory does not match what is
9+
# expected from the build.
10+
name: Check Transpiled JavaScript
11+
12+
on:
13+
pull_request:
14+
branches:
15+
- main
16+
push:
17+
branches:
18+
- main
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
check-dist:
25+
name: Check dist/
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
# Checkout the repository.
30+
- name: Checkout
31+
id: checkout
32+
uses: actions/checkout@v4
33+
34+
# Setup Node.js
35+
- name: Setup Node.js
36+
id: setup-node
37+
uses: actions/setup-node@v4
38+
with:
39+
cache: npm
40+
41+
# Install dependencies using `npm ci`.
42+
- name: Install Dependencies
43+
id: install
44+
run: npm ci
45+
46+
# Build the `dist/` directory.
47+
- name: Build dist/ Directory
48+
id: build
49+
run: npm run build
50+
51+
# This will fail the workflow if the `dist/` directory is different than
52+
# expected.
53+
- name: Compare Directories
54+
id: diff
55+
run: |
56+
if [ ! -d dist/ ]; then
57+
echo "Expected dist/ directory does not exist. See status below:"
58+
ls -la ./
59+
exit 1
60+
fi
61+
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
62+
echo "Detected uncommitted changes after build. See status below:"
63+
git diff --ignore-space-at-eol --text dist/
64+
exit 1
65+
fi
66+
67+
# If `dist/` was different than expected, upload the expected version as a
68+
# workflow artifact.
69+
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
70+
name: Upload Artifact
71+
id: upload
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: dist
75+
path: dist/

.github/workflows/package.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ignore:
2+
- ".github/"

0 commit comments

Comments
 (0)