Skip to content

Commit ad20921

Browse files
update CI configuration for GitHub Pages deployment
1 parent 6cc8962 commit ad20921

File tree

1 file changed

+46
-22
lines changed

1 file changed

+46
-22
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,64 @@
1-
name: CI
1+
name: Deploy to GitHub Pages
22

33
on:
44
push:
5-
branches:
6-
- main
7-
pull_request:
5+
branches: [main]
6+
workflow_dispatch:
87

98
permissions:
10-
actions: read
119
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: true
1216

1317
jobs:
14-
main:
18+
build:
1519
runs-on: ubuntu-latest
1620
steps:
17-
- uses: actions/checkout@v4
21+
- name: Checkout
22+
uses: actions/checkout@v4
1823
with:
19-
filter: tree:0
2024
fetch-depth: 0
2125

22-
# This enables task distribution via Nx Cloud
23-
# Run this command as early as possible, before dependencies are installed
24-
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
25-
# Uncomment this line to enable task distribution
26-
# - run: npx nx start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build"
26+
- name: Setup Pages
27+
uses: actions/configure-pages@v5
2728

28-
# Cache node_modules
29-
- uses: actions/setup-node@v4
29+
- name: Setup Node
30+
uses: actions/setup-node@v4
3031
with:
3132
node-version: 20
32-
cache: 'npm'
33+
cache: npm
34+
35+
- name: Install deps
36+
run: npm ci
3337

34-
- run: npm ci
38+
- name: Build app
39+
run: npx nx build low-code-ide --configuration=production --base-href=/low-code-ide/
3540

36-
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
37-
# - run: npx nx-cloud record -- echo Hello World
38-
# Nx Cloud recommends fixes for failures to help you get CI green faster. Learn more: https://nx.dev/ci/features/self-healing-ci
39-
- run: npx nx fix-ci
40-
if: always()
41+
- name: Add 404.html fallback
42+
run: |
43+
if [ -f dist/low-code-ide/index.html ]; then
44+
cp dist/low-code-ide/index.html dist/low-code-ide/404.html
45+
fi
46+
if [ -f dist/low-code-ide/browser/index.html ]; then
47+
cp dist/low-code-ide/browser/index.html dist/low-code-ide/browser/404.html
48+
fi
49+
50+
- name: Upload Pages artifact
51+
uses: actions/upload-pages-artifact@v4
52+
with:
53+
path: dist/low-code-ide
54+
55+
deploy:
56+
runs-on: ubuntu-latest
57+
needs: build
58+
environment:
59+
name: github-pages
60+
url: ${{ steps.deployment.outputs.page_url }}
61+
steps:
62+
- name: Deploy artifact
63+
id: deployment
64+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)