Skip to content

Commit 2f09a63

Browse files
committed
chore: fix github pages
1 parent d129f5e commit 2f09a63

File tree

3 files changed

+43
-31
lines changed

3 files changed

+43
-31
lines changed

.github/workflows/deploy.yml

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,56 @@ name: Deploy
33
on:
44
push:
55
branches: [main]
6+
# Allows you to run this workflow manually from the Actions tab
7+
workflow_dispatch:
8+
9+
# Allow one concurrent deployment
10+
concurrency:
11+
group: 'pages'
12+
cancel-in-progress: true
13+
14+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
619

720
jobs:
8-
# Build job
9-
build:
21+
deploy:
22+
defaults:
23+
run:
24+
working-directory: web-app
25+
26+
environment:
27+
name: github-pages
28+
url: ${{ steps.deployment.outputs.page_url }}
29+
1030
runs-on: ubuntu-latest
31+
1132
steps:
1233
- name: Checkout
1334
uses: actions/checkout@v4
14-
- name: Setup Pages
15-
id: pages
16-
uses: actions/configure-pages@v3
17-
- uses: actions/setup-node@v4
35+
- name: Get Node version
36+
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
37+
id: node-version
38+
- name: Set up Node
39+
uses: actions/setup-node@v4
1840
with:
19-
node-version: 20.x
20-
- run: npm ci
21-
working-directory: web-app
22-
- run: npx tsx generate-svg-icons-sprite.ts
23-
working-directory: web-app
24-
- run: npm run build
25-
working-directory: web-app
41+
cache-dependency-path: web-app/package-lock.json
42+
node-version: ${{ steps.node-version.outputs.NODE_VERSION }}
43+
cache: 'npm'
44+
- name: Install dependencies
45+
run: npm ci
46+
- name: Generate SVG icons sprite
47+
run: npx tsx generate-svg-icons-sprite.ts
48+
- name: Build
49+
run: npm run build
50+
- name: Setup Pages
51+
uses: actions/configure-pages@v5
2652
- name: Upload artifact
2753
uses: actions/upload-pages-artifact@v3
2854
with:
29-
path: 'web-app/build/client'
30-
31-
# Deployment job
32-
deploy:
33-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
34-
permissions:
35-
contents: read
36-
pages: write
37-
id-token: write
38-
environment:
39-
name: github-pages
40-
url: https://heiso.github.io/macrolev
41-
runs-on: ubuntu-latest
42-
needs: build
43-
steps:
55+
path: 'build/client'
4456
- name: Deploy to GitHub Pages
4557
id: deployment
4658
uses: actions/deploy-pages@v4

web-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"version": "0.0.0",
66
"scripts": {
77
"build": "cross-env NODE_ENV=production react-router build",
8-
"preview": "react-router preview",
8+
"preview": "vite preview",
99
"dev": "react-router dev",
1010
"start": "cross-env NODE_ENV=production react-router-serve ./build/server/index.js",
11-
"typecheck": "react-router typegen && tsc && && eslint . && prettier --check .",
11+
"typecheck": "react-router typegen && tsc && eslint . && prettier --check .",
1212
"check-dependencies": "npx npm-check-updates --peer --format group -i",
1313
"down": "pm2 delete ecosystem.config.cjs",
1414
"log": "pm2 log",

web-app/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ export default defineConfig({
1414
plugins: [autoprefixer],
1515
},
1616
},
17-
plugins: [reactRouter(), tsconfigPaths(), tailwindcss()],
17+
plugins: [tailwindcss(), reactRouter(), tsconfigPaths()],
1818
})

0 commit comments

Comments
 (0)