This repository has been archived by the owner on May 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (60 loc) · 2.28 KB
/
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
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
name: Deployment
# Controls when the workflow will run
on:
# Triggers the workflow on push events but only for the main branch
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
## Sets environment variable
OSOC_DB_USERNAME: ${{ secrets.OSOC_DB_USERNAME }}
OSOC_DB_PASSWORD: ${{ secrets.OSOC_DB_PASSWORD }}
OSOC_DB_URL: ${{ secrets.OSOC_DB_URL }}
OSOC_SCHEME: ${{ secrets.OSOC_SCHEME }}
OSOC_FRONTEND_URL: ${{ secrets.OSOC_FRONTEND_URL }}
OSOC_GMAIL_ADDRESS: ${{ secrets.OSOC_GMAIL_ADDRESS }}
OSOC_GMAIL_APP_PASSWORD: ${{ secrets.OSOC_GMAIL_APP_PASSWORD }}
jobs:
build:
runs-on: self-hosted
strategy:
matrix:
node-version: ['16.x']
java-version: ['17']
steps:
- uses: actions/checkout@v2
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Add env file to frontend directory
run: ln /home/selab2/.env .
working-directory: ./frontend
- name: Install and update yarn
run: npm install -g yarn
- name: Install yarn dependencies
run: yarn install --frozen-lockfile
working-directory: ./frontend
- name: Build react frontend with yarn
run: yarn build
working-directory: ./frontend
- name: Copy react files to production folder
run: cp -R frontend/ /home/selab2/production/
- name: Run the react app
run: sudo -E /home/selab2/production/start_frontend.sh
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin' # We are using temurin since adopt isn't supported anymore
cache: 'maven'
- name: Build spring backend with Maven
working-directory: ./backend
run: mvn -B package --file pom.xml
- name: Copy spring build files to production folder
run: cp /home/selab2/actions-runner/selab2/OSOC-1/OSOC-1/backend/target/backend-0.0.1-SNAPSHOT.jar /home/selab2/production/
working-directory: ./backend
- name: Execute Jar File
run: sudo -E /home/selab2/production/start_backend.sh