This repository has been archived by the owner on Jul 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
153 lines (123 loc) · 4.06 KB
/
ci.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: CI
on: [push, pull_request, workflow_dispatch]
env:
NODE_VERSION: 16.8.0
PNPM_VERSION: 6.15.1
JAVA_VERSION: 11
JAR_NAME: 'extracpus'
FILE_NAME: 'ExtraCPUs'
jobs:
check:
name: Lint & Build
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Gradle Wrapper Validation
uses: gradle/[email protected]
- name: Setup NodeJS ${{ env.NODE_VERSION }}
uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup pnpm Cache
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-node${{ env.NODE_VERSION }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: ${{ env.PNPM_VERSION }}
run_install: true
- name: Check Prettier Format
run: pnpx pretty-quick --check --verbose
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v2
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'adopt'
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonarqube --info
- name: Build
run: ./gradlew build --no-daemon
- name: Checks
run: ./gradlew check --no-daemon
- name: Test
run: ./gradlew test --no-daemon
publish:
name: Publish
runs-on: ubuntu-latest
needs: check
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Clone Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Gradle Wrapper Validation
uses: gradle/[email protected]
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v2
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'adopt'
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build
run: ./gradlew build --no-daemon
- name: Checks
run: ./gradlew check --no-daemon
- name: Test
run: ./gradlew test --no-daemon
- name: Assemble
run: ./gradlew jar --no-daemon
- name: Find the jar
run: echo "JAR_FILE=$(find build/libs/${{ env.JAR_NAME }}-*-*.jar)" >> $GITHUB_ENV
- name: Extract Minecraft and Mod Version
run: echo ${JAR_FILE%.*} | awk -F- '{ print "MINECRAFT_VERSION=" $2; print "MOD_VERSION=" $3; }' >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.FILE_NAME }}-${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}.jar
path: ${{ env.JAR_FILE }}
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ env.JAR_FILE }}
- name: Upload to CurseForge
run: ./gradlew curseforge
env:
CF_API_KEY: ${{ secrets.CF_API_KEY }}