forked from wet-boew/GCWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (56 loc) · 1.93 KB
/
demo-deploy.yml
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
name: Demo Deployment
on:
push:
branches:
- main
- 'gcweb-pr*'
- demo-deploy
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository and initialize submodules
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive # This initializes and updates submodules automatically
# Step 2: Set up Node.js and Bower
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Bower
run: npm install -g bower
# Step 3: Install dependencies and build demo files
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Build Demo Files (GCWeb)
run: |
grunt demo --branch=${{ github.ref_name }}
docker compose up -d
- name: Build Demo Files (WET-BOEW)
run: grunt dist
- name: List Files After Build
run: ls -R
# Step 4: Copy built files to a temporary directory for deployment
- name: Copy Built Files
run: |
mkdir -p demo_files
if [ -d "./~sites" ]; then cp -R ./~sites/* demo_files/; fi
if [ -d "./dist" ]; then cp -R ./dist/* demo_files/; fi
# Step 5: Deploy to gh-pages branch, including submodule update
- name: Deploy Demo
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GH_PAT }}
publish_dir: ./demo_files
publish_branch: gh-pages
user_name: 'GitHub Actions'
user_email: '[email protected]'
# Step 6: Add and commit submodule changes
- name: Update Submodules and .gitmodules
run: |
git submodule add -b ${{ github.ref_name }} https://github.com/ServiceCanada/wet-boew-demos.git ${{ github.ref_name }}
git add .gitmodules ${{ github.ref_name }}
git commit -m "Added submodule for ${{ github.ref_name }}"
git push origin gh-pages