File tree Expand file tree Collapse file tree 2 files changed +56
-29
lines changed
Expand file tree Collapse file tree 2 files changed +56
-29
lines changed Original file line number Diff line number Diff line change 1+ # `dist/index.js` is a special file in Actions.
2+ # When you reference an action with `uses:` in a workflow,
3+ # `index.js` is the code that will run.
4+ # For our project, we generate this file through a build process
5+ # from other source files.
6+ # We need to make sure the checked-in `index.js` actually matches what we expect it to be.
7+ name : Check dist/
8+
9+ on :
10+ pull_request :
11+ paths-ignore :
12+ - ' **.md'
13+ push :
14+ branches :
15+ - master
16+ paths-ignore :
17+ - ' **.md'
18+
19+ permissions :
20+ contents : read
21+
22+ jobs :
23+ check-dist :
24+ runs-on : ubuntu-latest
25+
26+ steps :
27+ - uses : actions/checkout@v4
28+
29+ - uses : pnpm/action-setup@v4
30+
31+ - uses : actions/setup-node@v4
32+ with :
33+ node-version : 22
34+ cache : pnpm
35+
36+ - name : Install dependencies
37+ run : pnpm install --frozen-lockfile
38+
39+ - name : Rebuild the dist/ directory
40+ run : pnpm run build
41+
42+ - name : Compare the expected and actual dist/ directories
43+ run : |
44+ if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
45+ echo "Detected uncommitted changes after build. See status below:"
46+ git diff --ignore-space-at-eol dist/
47+ exit 1
48+ fi
49+ id : diff
50+
51+ # If dist was different, upload the expected version as an artifact
52+ - uses : actions/upload-artifact@v4
53+ if : ${{ failure() && steps.diff.conclusion == 'failure' }}
54+ with :
55+ name : dist
56+ path : dist/
Original file line number Diff line number Diff line change 1919 config-file : release-please-config.json
2020 manifest-file : .release-please-manifest.json
2121
22- # The logic below handles the build and release process after release-please creates a release
23- - uses : actions/checkout@v4
24- if : ${{ steps.release.outputs.release_created }}
25-
26- - uses : pnpm/action-setup@v4
27- if : ${{ steps.release.outputs.release_created }}
28-
29- - uses : actions/setup-node@v4
30- if : ${{ steps.release.outputs.release_created }}
31- with :
32- node-version : 22
33- cache : pnpm
34-
35- - name : Install dependencies
36- if : ${{ steps.release.outputs.release_created }}
37- run : pnpm install --frozen-lockfile
38-
39- - name : Build distribution
40- if : ${{ steps.release.outputs.release_created }}
41- run : pnpm run package
42-
43- - name : Commit dist folder
44- if : ${{ steps.release.outputs.release_created }}
45- run : |
46- git config --global user.name 'github-actions[bot]'
47- git config --global user.email 'github-actions[bot]@users.noreply.github.com'
48- git add dist/
49- git diff --staged --quiet || git commit -m "chore: update dist folder for release ${{ steps.release.outputs.tag_name }}"
50- git push origin HEAD:master
You can’t perform that action at this time.
0 commit comments