-
Notifications
You must be signed in to change notification settings - Fork 1
127 lines (124 loc) · 4.04 KB
/
cd.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: CD
on:
release:
types: [created]
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
./.gradle/caches
./.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle.properties', '**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Build
run: ./gradlew shadowJar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: jar-artifact
path: ./build/libs/apollo-backend.jar
if-no-files-found: error
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ./.gradle/caches/modules-2/modules-2.lock
rm -f ./.gradle/caches/modules-2/gc.properties
upload-assets:
name: Upload assets
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: jar-artifact
path: .
- name: Release assets
uses: softprops/action-gh-release@v1
with:
files: ./apollo-backend.jar
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
documentation:
name: Documentation
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
./.gradle/caches
./.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Generate Documentation
run: ./gradlew dokkaHtml
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4.4.3
with:
branch: gh-pages
folder: build/dokka/html
clean: true
git-config-name: Jan Müller
git-config-email: janmueller3698@gmail.com
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ./.gradle/caches/modules-2/modules-2.lock
rm -f ./.gradle/caches/modules-2/gc.properties
# push_to_docker_hub:
# name: Push to Docker Hub
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Login
# uses: docker/login-action@be010b42938448d8a286c21d5c4ccf2aae1524a1
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@59bc9ddfd5a31eb6f5b55e89b65578fe3bbba85e
# with:
# images: deryeger/apollo-backend
# - name: Build and push Docker image
# uses: docker/build-push-action@965c6a410d446a30e95d35052c67d6eded60dad6
# with:
# context: .
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}