Skip to content

Commit 22a05b8

Browse files
committed
ci(github): Add job to deploy to production
1 parent 5f49bf2 commit 22a05b8

1 file changed

Lines changed: 39 additions & 2 deletions

File tree

.github/workflows/frontend.yml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ on:
77
- main
88

99
jobs:
10-
build:
11-
runs-on: ubuntu-22.04
10+
test:
11+
runs-on: ubuntu-latest
1212

1313
strategy:
1414
matrix:
@@ -49,6 +49,15 @@ jobs:
4949
commit_message: "ci(frontend): update test results"
5050
file_pattern: "frontend/src/lib/prerender-errors.json frontend/test-results/*.json"
5151

52+
pages:
53+
needs: test
54+
runs-on: ubuntu-latest
55+
56+
strategy:
57+
matrix:
58+
node-version: [20.x]
59+
60+
steps:
5261
- name: Build
5362
run: |
5463
npm run frontend:build
@@ -58,3 +67,31 @@ jobs:
5867
with:
5968
publish_dir: ./frontend/build
6069
github_token: ${{ secrets.GITHUB_TOKEN }}
70+
71+
prod:
72+
needs: test
73+
runs-on: ubuntu-latest
74+
75+
strategy:
76+
matrix:
77+
node-version: [20.x]
78+
79+
steps:
80+
- name: Update .env file
81+
run: |
82+
rm -f ./frontend/.env && touch ./frontend/.env
83+
echo DEBUG=false >> ./frontend/.env
84+
echo NODE_ENV=production >> ./frontend/.env
85+
86+
- name: Build
87+
run: |
88+
npm run frontend:build
89+
90+
- name: Deploy to production via SSH
91+
uses: easingthemes/ssh-deploy@v5.1.1
92+
with:
93+
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
94+
SOURCE: ./frontend/build
95+
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
96+
REMOTE_USER: ${{ secrets.REMOTE_USER }}
97+
TARGET: ${{ secrets.REMOTE_TARGET }}

0 commit comments

Comments
 (0)