Skip to content

Commit 19310df

Browse files
committed
Add CI
1 parent c8db491 commit 19310df

File tree

2 files changed

+84
-0
lines changed

2 files changed

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

0 commit comments

Comments
 (0)