Skip to content

Commit 697b145

Browse files
committed
👷 ci: add workflow to auto update dist
1 parent 38f4ca1 commit 697b145

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/update-dist.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Update Transpiled JavaScript
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
merge_group:
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
update-dist:
17+
name: Update dist/
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout
22+
id: checkout
23+
uses: actions/checkout@v6
24+
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v4
27+
28+
- name: Setup Node.js
29+
id: setup-node
30+
uses: actions/setup-node@v6
31+
with:
32+
node-version-file: .node-version
33+
cache: pnpm
34+
35+
- name: Install dependencies
36+
run: pnpm i --frozen-lockfile
37+
38+
- name: Build dist/ Directory
39+
id: build
40+
run: pnpm run bundle
41+
42+
# This will commit the updated `dist/` directory if it is different than
43+
# expected.
44+
- name: Commit Updated dist/
45+
id: commit
46+
run: |
47+
if [ ! -d dist/ ]; then
48+
echo "Expected dist/ directory does not exist. See status below:"
49+
ls -la ./
50+
exit 1
51+
fi
52+
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
53+
git config user.name "github-actions[bot]"
54+
git config user.email "github-actions[bot]@users.noreply.github.com"
55+
git add dist/
56+
git commit -m "🍱 chore: update transpiled JavaScript in dist/"
57+
else
58+
echo "No changes detected in dist/. No commit necessary."
59+
fi

0 commit comments

Comments
 (0)