-
Notifications
You must be signed in to change notification settings - Fork 6
32 lines (29 loc) · 1.41 KB
/
production-deployment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Production Deployment
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create .env file
run: touch .env && echo ${{ secrets.SENTRY_DSN_URL }} >> .env && echo ${{ secrets.PRODUCTION_ID_SILENT_REDIRECT_URI }} >> .env && echo ${{ secrets.PRODUCTION_ID_LOGOUT_REDIRECT_URI }} >> .env && echo ${{ secrets.PRODUCTION_ID_REDIRECT_URI }} >> .env && echo ${{ secrets.PRODUCTION_ID_CLIENT_ID }} >> .env && echo ${{ secrets.PRODUCTION_IDS_URL }} >> .env && echo ${{ secrets.PRODUCTION_ID_CALLBACK_URL }} >> .env && echo ${{ secrets.PRODUCTION_FRONTEND_URL }} >> .env && echo ${{ secrets.PRODUCTION_API_URL }} >> .env
- name: Build docker image
run: docker build -t digitalexcellence/frontend .
- name: Docker login
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Push images to Dockerhub
run: docker push digitalexcellence/frontend
- name: Push to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PRODUCTION_VPS_IP }}
username: ${{ secrets.PRODUCTION_VPS_USERNAME }}
password: ${{ secrets.PRODUCTION_VPS_PASSWORD }}
script: |
cd ~/docker_compose
docker-compose down
docker-compose pull
sleep 10s
docker-compose up -d