Skip to content

Commit 7f8390d

Browse files
Merge pull request #92 from StackOverflowIsBetterThanAnyAI/91-auto-deploy-workflow
auto deploy
2 parents 190762b + f2964a6 commit 7f8390d

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/deploy.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
cypress-run:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 22
23+
24+
- name: Install Dependencies
25+
run: npm i
26+
27+
- name: Build App
28+
run: npm run build
29+
30+
- name: Run Cypress Tests
31+
uses: cypress-io/github-action@v6
32+
with:
33+
start: npm start
34+
wait-on: 'http://localhost:3000'
35+
browser: chrome
36+
37+
- name: Upload Cypress Artifacts
38+
if: failure()
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: cypress-artifacts
42+
path: |
43+
cypress/screenshots
44+
cypress/videos
45+
46+
deploy:
47+
needs: cypress-run
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- name: Checkout Repository
52+
uses: actions/checkout@v3
53+
54+
- name: Setup Node.js
55+
uses: actions/setup-node@v3
56+
with:
57+
node-version: 22
58+
59+
- name: Install Dependencies
60+
run: npm i
61+
62+
- name: Build App
63+
run: npm run build
64+
65+
- name: Configure User
66+
run: |
67+
git config --global user.email "github-actions@github.com"
68+
git config --global user.name "github-actions[bot]"
69+
70+
- name: Deploy to GitHub Pages
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
run: npx gh-pages -d build --repo https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git

0 commit comments

Comments
 (0)