-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (77 loc) · 2.29 KB
/
deploy-on-tag.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
name: CD - Deploy on Tags
on:
push:
tags:
- '*.*.*'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Setup Gradle cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build application JAR
run: ./gradlew --no-daemon bootJar copyJarToDeploy
- name: Deploy to server
uses: SamKirkland/[email protected]
if: ${{ !env.ACT }}
with:
server: ${{ secrets.FTP_SERVER }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
server-dir: ${{ vars.FTP_DIR }}
local-dir: ./deploy/
- name: Wait a bit at the end of deployment
run: |
sleep ${{ vars.DELAY_AFTER_DEPLOY }}
create-github-release:
needs: deploy
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: marvinpinto/[email protected]
if: ${{ !env.ACT }}
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
draft: true
restart-server:
if: ${{ vars.ENABLE_HTTP_CALLS }}
needs:
- deploy
uses: ./.github/workflows/restart-server.yml
secrets: inherit
notify-release-analytics:
if: ${{ vars.ENABLE_HTTP_CALLS }}
needs:
- deploy
- restart-server
runs-on: ubuntu-latest
steps:
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Notify release
uses: fjogeleit/http-request-action@v1
with:
url: ${{ vars.SERVER_ENDPOINT }}/notifyRelease?version=${{ steps.get_version.outputs.VERSION }}
method: POST
customHeaders: >-
{
"X-Secret-Key": "${{ secrets.SERVER_MAINTENANCE_SECRET_KEY }}"
}