-
-
Notifications
You must be signed in to change notification settings - Fork 15
114 lines (112 loc) · 3.73 KB
/
build_and_release.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
name: Server builds
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
workflow_dispatch:
#This permission is needed to push a release (and/or tags)
permissions:
contents: write #nessesary for tag creation and release creation
actions: write #nessesary for cache deletion
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Java 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Cache .gradle
uses: burrunan/gradle-cache-action@v1
with:
# Enable concurrent cache save and restore
# Default is concurrent=false for better log readability
concurrent: true
# Disable caching of $HOME/.gradle/caches/*.*/generated-gradle-jars
save-generated-gradle-jars: false
# Disable publishing Gradle Build Scan URL to job report
gradle-build-scan-report: false
- name: Restore Project Sources for faster setup
id: cache_projects-src_restore
uses: actions/cache/restore@v3
with:
path: |
projects/
key: project-src-cache-${{ hashFiles('patches') }}
restore-keys: |
project-src-cache-
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup Ketting
id: setup
run: ./gradlew setup
- name: Save Project Sources
if: steps.cache_projects-src_restore.output.cache-hit == 'false'
uses: actions/cache/save@v3
with:
path: |
projects/
key: ${{ steps.cache_projects-src_restore.outputs.cache-primary-key }}
- name: Save Project Sources for build
if: false
uses: actions/cache/save@v3
with:
path: |
projects/
key: project-src-cache-${{ github.ref }}-${{ github.sha }}
build:
if: false
runs-on: ubuntu-latest
needs: setup
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Java 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Cache .gradle
uses: burrunan/gradle-cache-action@v1
with:
# Enable concurrent cache save and restore
# Default is concurrent=false for better log readability
concurrent: true
# Disable caching of $HOME/.gradle/caches/*.*/generated-gradle-jars
save-generated-gradle-jars: false
# Disable publishing Gradle Build Scan URL to job report
gradle-build-scan-report: false
- name: Restore Project Sources for build
uses: actions/cache/restore@v3
with:
path: |
projects/
key: project-src-cache-${{ github.ref }}-${{ github.sha }}
- name: Delete Project Sources for build
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH=${{ github.ref }}
echo "Deleting caches..."
## Setting this to not fail the workflow while deleting cache keys.
#set +e
gh actions-cache delete project-src-cache-${{ github.ref }}-${{ github.sha }} -R $REPO -B $BRANCH --confirm
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build Ketting Jar
run: ./gradlew kettingJar
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: project-forge-build-libs
path: |
projects/forge/build/libs/