Skip to content

Commit f6fada1

Browse files
Merge pull request #16 from montoyamoraga/main
agregar gh-deploy
2 parents 9f32ef9 + 188c3cb commit f6fada1

File tree

3 files changed

+74
-3
lines changed

3 files changed

+74
-3
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Deploy Mechanic static site to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pages: write
11+
id-token: write
12+
13+
jobs:
14+
build-and-deploy:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Cache node modules
21+
uses: actions/cache@v4
22+
with:
23+
path: ~/.npm
24+
key: ${{ runner.os }}-node-${{ hashFiles('my-project/package-lock.json') }}
25+
restore-keys: |
26+
${{ runner.os }}-node-
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '18'
32+
33+
- name: Install dependencies
34+
run: npm install
35+
working-directory: ./my-project
36+
37+
- name: Clean possible lockfiles
38+
run: rm -f mechanic.json.lock
39+
working-directory: ./my-project
40+
41+
- name: Build Mechanic static site
42+
run: npm run build
43+
working-directory: ./my-project
44+
45+
- name: Check if dist exists
46+
run: |
47+
if [ ! -d "./dist" ]; then
48+
echo "ERROR: ./dist was not created by the build."
49+
exit 1
50+
fi
51+
working-directory: ./my-project
52+
53+
- name: List build output
54+
run: ls -la ./dist
55+
working-directory: ./my-project
56+
57+
- name: Add .nojekyll
58+
run: touch ./my-project/dist/.nojekyll
59+
60+
- run: npm install
61+
working-directory: ./my-project
62+
63+
- name: Deploy to GitHub Pages
64+
uses: peaceiris/actions-gh-pages@v4
65+
with:
66+
github_token: ${{ secrets.GITHUB_TOKEN }}
67+
publish_dir: ./my-project/dist

faaad/mechanic.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
module.exports = {
22
hooks: [],
3-
port: 3000
3+
port: 3000,
4+
basePath: "/faaad-graficas/",
5+
publicPath: "/faaad-graficas/",
46
};

faaad/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
},
1010
"devDependencies": {
1111
"@mechanic-design/cli": "^2.0.0-beta.12",
12-
"@mechanic-design/core": "^2.0.0-beta.12"
12+
"@mechanic-design/core": "^2.0.0-beta.12",
13+
"gh-pages": "^6.3.0"
1314
},
1415
"dependencies": {
1516
"@disenoudp/faaad-colores": "^0.0.6",
16-
"@mechanic-design/engine-p5": "^2.0.0-beta.12"
17+
"@mechanic-design/engine-p5": "^2.0.0-beta.12",
18+
"node-modules": "^1.0.1"
1719
}
1820
}

0 commit comments

Comments
 (0)