-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (59 loc) · 2.01 KB
/
build-deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Build and deploy
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Components and overrides
- name: Combine and clean CSS files
run: |
mkdir -p dist
find components overrides -name '*.css' -exec sed -e '/^\/\*/d' -e '/^\*\//d' -e '/^ \* /d' -e '/^\/\//d' {} + >> dist/combined.css
- name: Combine and clean JS files
run: |
find components overrides -name '*.js' -exec sed -e '/^\/\*/d' -e '/^\*\//d' -e '/^ \* /d' -e '/^\/\//d' {} + >> dist/combined.js
- name: Add CSS license header and add file
run: |
cat .github/license-header_css.txt > dist/temp.css
cat dist/combined.css >> dist/temp.css
mv dist/temp.css dist/combined.css
- name: Add JS license header and add file
run: |
cat .github/license-header_js.txt > dist/temp.js
cat dist/combined.js >> dist/temp.js
mv dist/temp.js dist/combined.js
# Media files
- name: Find and add all media
run: |
mkdir -p dist/media
find . -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.webp" \) -exec mv {} dist/media/ \;
# README and LICENSE
- name: Add repository README and LICENSE
run: |
mv "$GITHUB_WORKSPACE/README.md" "$GITHUB_WORKSPACE/LICENSE" dist/
# Blog files
# (Remove or modify this accordingly)
- name: Find and add blog files
run: |
mkdir -p dist/blog
find "$GITHUB_WORKSPACE/blog" -type f -exec mv {} dist/blog/ \;
# Build artifact
- name: Create build artifact
uses: actions/upload-artifact@v4
with:
name: combined-files
path: dist/
# Deploy build
- name: Deploy to Cloudflare Pages
uses: cloudflare/pages-action@v1.5.0
with:
apiToken: ${{ secrets.CF_PAGES_TOKEN }}
accountId: ${{ secrets.CF_PAGES_ACCOUNT_ID }}
projectName: ghost-components
directory: dist