-
Notifications
You must be signed in to change notification settings - Fork 26
109 lines (95 loc) · 4.09 KB
/
gradle.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
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Gradle Build
run-name: Gradle Build ${{ github.ref_name }}
on:
workflow_dispatch:
inputs:
deploy_curseforge:
description: 'Deploy to Curseforge'
type: boolean
default: false
deploy_modrinth:
description: 'Deploy to Modrinth'
type: boolean
default: false
create_github_release:
description: 'Create Github Release'
type: boolean
default: false
env:
JAVA_VERSION: 17
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 1.${{ env.JAVA_VERSION }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
id: gradle_build
run: |
./gradlew build versionTxt
echo "artifactversion=`basename \`cat ./build/libs/version.txt\``"
echo "artifactversion=`basename \`cat ./build/libs/version.txt\``" >> $GITHUB_OUTPUT
echo "artifactname=`basename \`cat ./build/libs/artifact.txt\``"
echo "artifactname=`basename \`cat ./build/libs/artifact.txt\``" >> $GITHUB_OUTPUT
echo "artifactfullname=`realpath ./build/libs/\`cat ./build/libs/artifact.txt\``"
echo "artifactfullname=`realpath ./build/libs/\`cat ./build/libs/artifact.txt\``" >> $GITHUB_OUTPUT
echo "mcversion=`basename ${{ github.ref }}`"
echo "mcversion=`basename ${{ github.ref }}`" >> $GITHUB_OUTPUT
if [[ `cat ./build/libs/version.txt` == *-alpha ]]
then
echo "releasetype=alpha"
echo "releasetype=alpha" >> $GITHUB_OUTPUT
elif [[ `cat ./build/libs/version.txt` == *-beta ]]
then
echo "releasetype=beta"
echo "releasetype=beta" >> $GITHUB_OUTPUT
else
echo "releasetype=release"
echo "releasetype=release" >> $GITHUB_OUTPUT
fi
- name: Create Github Release
id: create_github_release
if: ${{ !cancelled() && steps.gradle_build.outcome == 'success' && github.event.inputs.create_github_release == 'true' }}
uses: ncipollo/release-action@v1
with:
bodyFile: "changelog.md"
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "${{ steps.gradle_build.outputs.artifactfullname }}"
tag: "mc${{ steps.gradle_build.outputs.mcversion }}-${{ steps.gradle_build.outputs.artifactversion }}"
- name: Publish to Modrinth
id: publish_modrinth
if: ${{ !cancelled() && steps.gradle_build.outcome == 'success' && github.event.inputs.deploy_modrinth == 'true' }}
uses: Kir-Antipov/[email protected]
with:
modrinth-id: "Tl8ESrhX"
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
files: ${{ steps.gradle_build.outputs.artifactfullname }}
name: torchmaster-${{ steps.gradle_build.outputs.artifactversion }}
version: ${{ steps.gradle_build.outputs.artifactversion }}
version-type: ${{ steps.gradle_build.outputs.releasetype }}
changelog-file: changelog.md
loaders: forge
game-versions: ${{ steps.gradle_build.outputs.mcversion }}
java: ${{ env.JAVA_VERSION }}
- name: Publish to Curseforge
id: publish_curseforge
if: ${{ !cancelled() && steps.gradle_build.outcome == 'success' && github.event.inputs.deploy_curseforge == 'true' }}
uses: Kir-Antipov/[email protected]
with:
curseforge-id: "254268"
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
files: ${{ steps.gradle_build.outputs.artifactfullname }}
name: torchmaster-${{ steps.gradle_build.outputs.artifactversion }}
version: ${{ steps.gradle_build.outputs.artifactversion }}
version-type: ${{ steps.gradle_build.outputs.releasetype }}
changelog-file: changelog.md
loaders: forge
game-versions: ${{ steps.gradle_build.outputs.mcversion }}
java: ${{ env.JAVA_VERSION }}