This repository has been archived by the owner on Mar 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (71 loc) · 2.01 KB
/
push.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
83
84
85
86
87
88
89
90
91
92
93
name: Push
on:
push:
branches:
- master
- stable
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'adopt'
- name: Tests
run: mvn test
build:
runs-on: ubuntu-latest
needs:
- test
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'adopt'
- name: Build
run: mvn -B package -DskipTests
docker:
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: registry.ziedelth.fr:5000
username: ziedelth
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push production
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/stable'
with:
context: .
push: true
tags: registry.ziedelth.fr:5000/jais-api:latest
release:
if: github.ref == 'refs/heads/stable'
name: Release
runs-on: ubuntu-latest
needs:
- docker
steps:
- name: Install SSH KEY
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
- name: Adding Known Hosts
run: ssh-keyscan -p 2222 -H ${{ secrets.SSH_HOST_IP }} >> ~/.ssh/known_hosts
- name: SSH Commands
run: |
ssh -C -p 2222 ${{ secrets.SSH_DESTINATION }} "docker pull localhost:5000/jais-api:latest && cd ${{ secrets.SSH_FOLDER }} && docker compose down jais-api && docker compose up -d"