Skip to content

Commit 7efa52a

Browse files
committed
Add CI
1 parent c8db491 commit 7efa52a

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed

.env.deploy

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
API_URL=https://jobfair.fer.unizg.hr/api
2+
BASE_URL=https://jobfair.fer.unizg.hr
3+
HOST=0.0.0.0
4+
PORT=3000
5+
NODE_ENV=production
6+
SENTRY_DSN=https://[email protected]/6201298
7+
NUXT_PUBLIC_GTAG_ID=G-TG1E1XGR6F
8+
NUXT_PUBLIC_PLAUSIBLE_DOMAIN=jobfair.fer.unizg.hr
9+
NUXT_PUBLIC_PLAUSIBLE_API_HOST=https://jobfair.fer.unizg.hr/pevts

.github/workflows/deploy.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build and deploy
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
build-frontend:
15+
runs-on: [self-hosted]
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Login to Docker Hub
19+
uses: docker/login-action@v3
20+
if: github.event_name != 'pull_request'
21+
with:
22+
username: ${{ vars.DOCKERHUB_USERNAME }}
23+
password: ${{ secrets.DOCKERHUB_TOKEN }}
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
- name: Setup env
27+
run: |
28+
cp .env.deploy .env
29+
- name: Build and push
30+
uses: docker/build-push-action@v6
31+
with:
32+
context: .
33+
file: .docker/frontend/Dockerfile
34+
push: ${{ github.event_name != 'pull_request' }}
35+
pull: true
36+
tags: |
37+
ksetcomp/jobfair-2022-frontend:latest
38+
ksetcomp/jobfair-2022-frontend:${{ github.sha }}
39+
40+
build-backend:
41+
runs-on: [self-hosted]
42+
steps:
43+
- uses: actions/checkout@v3
44+
- name: Login to Docker Hub
45+
uses: docker/login-action@v3
46+
if: github.event_name != 'pull_request'
47+
with:
48+
username: ${{ vars.DOCKERHUB_USERNAME }}
49+
password: ${{ secrets.DOCKERHUB_TOKEN }}
50+
- name: Set up Docker Buildx
51+
uses: docker/setup-buildx-action@v3
52+
- name: Setup env
53+
run: |
54+
cp .env.example ./backend/.env
55+
- name: Build and push
56+
uses: docker/build-push-action@v6
57+
with:
58+
context: ./backend
59+
file: .docker/backend/Dockerfile
60+
push: ${{ github.event_name != 'pull_request' }}
61+
pull: true
62+
tags: |
63+
ksetcomp/jobfair-2022-backend:latest
64+
ksetcomp/jobfair-2022-backend:${{ github.sha }}
65+
66+
notify-watchtower:
67+
runs-on: [self-hosted]
68+
needs: [build-frontend, build-backend]
69+
steps:
70+
- name: Notify Watchtower
71+
run: |
72+
curl -sL -v \
73+
--header 'Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}' \
74+
"${{ vars.WATCHTOWER_URL }}/v1/update"

0 commit comments

Comments
 (0)