Skip to content

Commit 4f5b61d

Browse files
ErioldDaniel Montoya
andauthored
feat(yml): configuration jobs to deploy gh-pages (#573)
Co-authored-by: Daniel Montoya <daniel.montoya@eclass.cl>
1 parent b19797f commit 4f5b61d

File tree

2 files changed

+118
-55
lines changed

2 files changed

+118
-55
lines changed

.github/workflows/nodejs.yml

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,20 @@ jobs:
5959
env:
6060
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6161
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
62-
pages:
63-
if: github.ref == 'refs/heads/main'
62+
63+
build-pages:
64+
name: Build to GitHub Pages
6465
needs: release
6566
runs-on: ubuntu-latest
67+
env:
68+
VITE_REACT_DEPLOY_DOCUMENTATION: DOCUMENTATION
69+
6670
steps:
67-
- uses: actions/checkout@v3
68-
- uses: actions/setup-node@v3
71+
- name: Checkout repo
72+
uses: actions/checkout@v3
73+
74+
- name: Setup Node
75+
uses: actions/setup-node@v3
6976
with:
7077
node-version: 14.21.3
7178
cache: 'npm'
@@ -76,9 +83,55 @@ jobs:
7683
run: |
7784
ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts
7885
shell: bash
79-
- name: Deploy to GH Pages with vite server
80-
env:
81-
GH_TOKEN: eclass:${{ secrets.GITHUB_TOKEN }}
82-
VITE_REACT_DEPLOY_DOCUMENTATION: ${{secrets.VITE_REACT_DEPLOY_DOCUMENTATION}}
83-
run: npm run deploy
86+
- name: Clean install on CI
87+
run: npm ci
88+
- name: Generate new Build to Pages
89+
run: npm run build
90+
- name: Upload deploy-ready build files
91+
uses: actions/upload-artifact@v3
92+
with:
93+
name: deploy-files
94+
path: ./dist
95+
96+
deploy-pages:
97+
name: Deploy GitHub Pages
98+
needs: build-pages
99+
runs-on: ubuntu-latest
100+
if: github.ref == 'refs/heads/main'
101+
102+
env:
103+
VITE_REACT_DEPLOY_DOCUMENTATION: DOCUMENTATION
104+
105+
steps:
106+
- name: Download artifact
107+
uses: actions/download-artifact@v3
108+
with:
109+
name: deploy-files
110+
path: ./dist
84111

112+
# - uses: actions/checkout@v3
113+
# - uses: actions/setup-node@v3
114+
# with:
115+
# node-version: 14.21.3
116+
# cache: 'npm'
117+
# - uses: webfactory/ssh-agent@v0.7.0
118+
# with:
119+
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
120+
# - name: Add Know Hosts
121+
# run: |
122+
# ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts
123+
# shell: bash
124+
# - name: Clean install on CI
125+
# run: npm ci
126+
# - name: Generate new Build to Pages
127+
# run: npm run build
128+
# - name: Download artifact
129+
# uses: actions/download-artifact@v3
130+
# with:
131+
# name:
132+
133+
- name: Deploy to GitHub Pages
134+
uses: peaceiris/actions-gh-pages@v3
135+
with:
136+
github_token: eclass:${{ secrets.GITHUB_TOKEN }}
137+
publish_dir: ./dist

package-lock.json

Lines changed: 56 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)