-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (68 loc) · 2.48 KB
/
deployment-and-hosting-frontend.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Frontend Deployment and Hosting
on:
push:
branches:
- master
- main
- develop
pull_request:
branches:
- master
- main
- develop
jobs:
build-and-push-frontend:
runs-on: ubuntu-latest
name: "DockerHub: Frontend"
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Setup Node.js Environment
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERUSSER }}
password: ${{ secrets.DOCKERPASS }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push frontend Docker image
run: |
echo "--------- Building frontend Docker image -----------"
docker build -t infiniteloopers-frontend-app ./frontend
docker tag infiniteloopers-frontend-app ${{ secrets.DOCKERUSSER }}/infiniteloopers-frontend-app:v1
docker push ${{ secrets.DOCKERUSSER }}/infiniteloopers-frontend-app:v1
env:
BACKEND_URL: ${{ secrets.BACKEND_URL }}
# deploy-frontend:
# runs-on: ubuntu-latest
# needs: build-and-push-frontend
# name: "Heroku: Frontend App Hosting"
# environment:
# name: production
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Set up Node.js
# uses: actions/setup-node@v2
# with:
# node-version: '20'
# registry-url: 'https://npm.pkg.github.com'
# - name: Set Git User Info
# run: |
# git config --global user.name "${{ secrets.GIT_USER }}"
# git config --global user.email "${{ secrets.GIT_USER_EMAIL }}"
# - name: Set up Heroku CLI
# run: curl https://cli-assets.heroku.com/install.sh | sh
# - name: Authenticate with Heroku
# run: |
# echo "machine api.heroku.com login ${{ secrets.HEROKU_EMAIL }} password ${{ secrets.HEROKU_API_KEY }}" > ~/.netrc
# echo "machine git.heroku.com login ${{ secrets.HEROKU_EMAIL }} password ${{ secrets.HEROKU_API_KEY }}" >> ~/.netrc
# - name: Pushing Frontend Directory to Heroku
# run: |
# git clone https://github.com/COS301-SE-2024/The-Republic.git
# cd The-Republic
# heroku git:remote -a "${{ secrets.HEROKU_FRONTEND }}"
# git subtree push --prefix frontend heroku master