1
+ name : CI
2
+ on :
3
+ push :
4
+ branches :
5
+ - ' nyan-work/dev'
6
+
7
+ jobs :
8
+ build :
9
+ if : ${{ github.event_name == 'push' && !startsWith(github.event.ref, 'refs/tags/') && contains(github.event.head_commit.message, '[build skip]') == false }}
10
+ strategy :
11
+ matrix :
12
+ java : [ 17 ]
13
+ os : [ ubuntu-latest ]
14
+ runs-on : ${{ matrix.os }}
15
+ steps :
16
+ - name : Checkout the sources
17
+ uses : actions/checkout@v3
18
+ with :
19
+ fetch-depth : 0
20
+
21
+ - name : Set up JDK ${{ matrix.java }}
22
+ uses : actions/setup-java@v3
23
+ with :
24
+ distribution : ' adopt'
25
+ java-version : ${{ matrix.java }}
26
+
27
+ - name : Cache Gradle packages
28
+ uses : actions/cache@v3
29
+ with :
30
+ path : |
31
+ ~/.gradle/caches
32
+ ./.gradle/loom-caches
33
+ ~/.gradle/wrapper
34
+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
35
+
36
+ - name : Get short commit sha
37
+ id : get_short_sha
38
+ run : |
39
+ short_sha=$(echo ${GITHUB_SHA} | cut -c1-7)
40
+ echo "short_sha=$short_sha" >> $GITHUB_OUTPUT
41
+
42
+ - name : Get commit count
43
+ id : get_commit_count
44
+ run : |
45
+ commit_count=$(git log | grep -e 'commit [a-zA-Z0-9]*' | wc -l)
46
+ echo "commit_count=$commit_count" >> $GITHUB_OUTPUT
47
+
48
+ - name : Read Properties mod info
49
+ id : mod_info
50
+ uses :
christian-draeger/[email protected]
51
+ with :
52
+ path : gradle.properties
53
+ properties : ' mod_name mod_version'
54
+
55
+ - name : Grant execute permission for gradlew
56
+ run : chmod +x gradlew
57
+
58
+ - name : Preprocess sources
59
+ env :
60
+ BUILD_TYPE : " BETA"
61
+ run : ./gradlew preprocessResources --stacktrace
62
+
63
+ - name : Publish Maven with Gradle
64
+ env :
65
+ BUILD_TYPE : " BETA"
66
+ run : ./gradlew build --stacktrace
67
+
68
+ - name : Upload assets to GitHub Action
69
+ uses : actions/upload-artifact@v3
70
+ with :
71
+ name : " ${{ steps.mod_info.outputs.mod_name }} ${{ steps.mod_info.outputs.mod_version }}.${{ steps.get_commit_count.outputs.commit_count }}+${{ steps.get_short_sha.outputs.short_sha }}"
72
+ path : |
73
+ LICENSE
74
+ fabricWrapper/build/libs/*.jar
75
+ fabricWrapper/build/tmp/submods/META-INF/jars/*.jar
76
+
77
+ - name : Create Github release
78
+ if : contains(github.event.head_commit.message, '[publish skip]') == false && contains(github.event.ref, 'refs/heads/exp') == false
79
+ uses : softprops/action-gh-release@v1
80
+ with :
81
+ prerelease : true
82
+ files : |
83
+ LICENSE
84
+ fabricWrapper/build/libs/*.jar
85
+ fabricWrapper/build/tmp/submods/META-INF/jars/*.jar
86
+ name : " [CI#${{ github.run_number }}]${{ steps.mod_info.outputs.mod_name }} ${{ steps.mod_info.outputs.mod_version }}.${{ steps.get_commit_count.outputs.commit_count }}+${{ steps.get_short_sha.outputs.short_sha }}"
87
+ tag_name : " ${{ github.ref_name }}.${{ github.run_number }}"
88
+ target_commitish : ${{ github.event.ref }}
89
+ generate_release_notes : true
0 commit comments