Skip to content

Commit 061161e

Browse files
committed
feat: Add GitHub Actions workflow for building and committing CSS files
1 parent bbca3b4 commit 061161e

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 🚀 Build SCSS and Update dist/
2+
3+
on:
4+
push:
5+
paths:
6+
- 'css/scss/**'
7+
- '.github/workflows/build-publish.yml'
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
name: Compile and Commit dist/
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: ⬇️ Checkout repo
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
22+
- name: 🔧 Set up Node
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: 20
26+
27+
- name: 📦 Install dependencies
28+
run: npm install
29+
30+
- name: 🧱 Build CSS
31+
run: npm run build
32+
33+
- name: 📂 Copy compiled CSS to dist/
34+
run: |
35+
mkdir -p dist
36+
cp css/musgo.css dist/
37+
cp css/musgo-block-grid.css dist/
38+
39+
- name: 📤 Commit dist files
40+
run: |
41+
git config --global user.name "github-actions"
42+
git config --global user.email "actions@github.com"
43+
git add dist
44+
git commit -m "📦 Update dist folder [skip ci]" || echo "No changes to commit"
45+
git push

dist/.keep

Whitespace-only changes.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"doc": "docs"
88
},
99
"scripts": {
10-
"build:sass": "sass css/scss/musgo.scss css/musgo.css && sass css/scss/musgo-block-grid.scss css/musgo-block-grid.css",
11-
"build:postcss": "postcss css/musgo.css -o css/musgo.css && postcss css/musgo-block-grid.css -o css/musgo-block-grid.css",
10+
"build:sass": "sass css/scss/musgo.scss dist/musgo.css && sass css/scss/musgo-block-grid.scss dist/musgo-block-grid.css",
11+
"build:postcss": "postcss dist/musgo.css -o dist/musgo.css && postcss dist/musgo-block-grid.css -o dist/musgo-block-grid.css",
1212
"build": "npm run build:sass && npm run build:postcss"
1313
},
1414
"keywords": [],

0 commit comments

Comments
 (0)