-
Notifications
You must be signed in to change notification settings - Fork 2
58 lines (56 loc) · 1.84 KB
/
deploy.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
name: deploy
on:
release:
types: [ created ]
workflow_run:
workflows: [ "build" ]
types: [ completed ]
branches: [ master ]
jobs:
deploy-jar:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' || github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build JAR
run: ./gradlew bootJar
- name: Copy JAR to Oracle VM
uses: appleboy/[email protected]
with:
host: ${{ secrets.ORACLE_HOST }}
username: ${{ secrets.ORACLE_USERNAME }}
key: ${{ secrets.ORACLE_KEY }}
source: "build/libs/*.jar"
target: "sofia-supermarkets-api/jars"
strip_components: 2
- name: Restart systemd service
uses: appleboy/[email protected]
with:
host: ${{ secrets.ORACLE_HOST }}
username: ${{ secrets.ORACLE_USERNAME }}
key: ${{ secrets.ORACLE_KEY }}
script: |
chmod 775 sofia-supermarkets-api/jars/*.jar
echo "Restarting systemd service"
sudo systemctl restart sofia-supermarkets-api
sleep 10
echo "Verifying service is active"
sudo systemctl is-active sofia-supermarkets-api
deploy-proxy:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' || github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v3
- name: Publish worker to Cloudflare
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
workingDirectory: "proxy"
command: deploy