Skip to content

Commit 430c298

Browse files
authored
build: cicd.yml (#33)
1 parent 7e5f19a commit 430c298

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/cicd.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: ci/cd
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
build-backend:
11+
runs-on: ubuntu-22.04
12+
defaults:
13+
run:
14+
working-directory: backend
15+
16+
steps:
17+
- name: Set up Repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: "17"
24+
distribution: "corretto"
25+
26+
- name: Give permission for Gradle
27+
run: chmod +x gradlew
28+
29+
- name: Cache Gradle
30+
id: cache-gradle
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.gradle/caches
34+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
35+
restore-keys: |
36+
${{ runner.os }}-gradle-
37+
- name: Build with Gradle
38+
run: ./gradlew bootJar
39+
40+
- name: Upload jar file artifact
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: BackendApplicationJar
44+
path: backend/build/libs/*.jar
45+
46+
deploy:
47+
needs: [build-backend]
48+
runs-on: self-hosted
49+
50+
steps:
51+
- name: Remove previous version FRONT app
52+
working-directory: frontend/prod/
53+
run: rm -rf dist
54+
55+
- name: Remove previous version BACK jar
56+
working-directory: backend/prod/
57+
run: rm -f *.jar
58+
59+
- name: Download BACK jar file from artifact
60+
uses: actions/download-artifact@v4
61+
with:
62+
name: BackendApplicationJar
63+
path: backend/prod/

0 commit comments

Comments
 (0)