-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (43 loc) · 1.72 KB
/
deploy-swagger.yml
File metadata and controls
53 lines (43 loc) · 1.72 KB
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
name: Generate and Deploy Swagger YAML
on:
push:
branches: [ dev ]
jobs:
generate-swagger:
runs-on: ubuntu-latest
steps:
- name: Checkout server repo
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Give execute permission for gradlew
run: chmod +x ./gradlew
- name: Build jar
run: ./gradlew bootJar -x test
- name: Run server and wait for it to be ready
env:
JWT_SECRET: ${{ secrets.JWT_SECRET }}
run: |
nohup java -jar build/libs/*.jar > server.log 2>&1 &
for i in {1..36}; do
curl -f http://localhost:8080/actuator/health && break
echo "Waiting for server to start..."
sleep 5
done
curl -f http://localhost:8080/actuator/health || (echo "Server did not start in time. Here's the log:" && tail -n 100 server.log && exit 1)
- name: Generate swagger.yaml
run: curl http://localhost:8080/v3/api-docs.yaml -o swagger.yaml
- name: Clone swagger repo and overwrite file
run: |
git clone https://x-access-token:${{ secrets.SWAGGER_REPO_TOKEN }}@github.com/MATEBALL/MATEBALL-SWAGGER.git
cp swagger.yaml MATEBALL-SWAGGER/swagger.yaml
- name: Commit and push updated swagger.yaml
run: |
cd MATEBALL-SWAGGER
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add swagger.yaml
git diff --quiet && echo "No changes to commit" || (git commit -m "update: swagger.yaml from MATEBALL-SERVER" && git push)