Skip to content

Commit e49ac4f

Browse files
authored
Added build.yaml 📥
1 parent 28a8aa9 commit e49ac4f

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/build.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build and Commit Changes
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build-and-commit:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v3
13+
14+
- name: Set up Node.js environment
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: '14'
18+
19+
- name: Build project using Webpack/Rollup
20+
run: |
21+
npm i
22+
npm run build
23+
24+
- name: Commit and push changes
25+
run: |
26+
git config --global user.name "GitHub Actions"
27+
git config --global user.email "actions@github.com"
28+
git add -A
29+
git reset -- node_modules # Unstage the node_modules changes
30+
if ! git diff --cached --quiet; then
31+
git diff --cached --name-only | while read -r file; do
32+
commit_message="Updated $file :inbox_tray:"
33+
git commit -m "$commit_message" -- "$file"
34+
done
35+
36+
git push
37+
else
38+
echo "No changes to commit."
39+
fi

0 commit comments

Comments
 (0)