-
Notifications
You must be signed in to change notification settings - Fork 9
138 lines (123 loc) · 5.05 KB
/
build_and_release.yml
File metadata and controls
138 lines (123 loc) · 5.05 KB
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
name: Build and Publish Release
on:
release:
types: [ published ]
env:
MODID: "toolleveling"
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
java-version: ${{ steps.properties.outputs.java_version }}
mc-version: ${{ steps.properties.outputs.minecraft_version }}
mod-version: ${{ steps.properties.outputs.mod_version }}
version-range: ${{ steps.properties.outputs.version_range }}
steps:
- name: Checkout Sourcecode
uses: actions/checkout@v4
- name: calculate versions
id: properties
uses: christian-draeger/read-properties@1.1.1
with:
path: 'gradle.properties'
properties: 'minecraft_version mod_version version_range java_version'
- name: Changelog
shell: bash
run: |
echo "# Changelog ${{ steps.properties.outputs.minecraft_version }} - ${{ steps.properties.outputs.mod_version }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "${{ github.event.release.body }}" >> $GITHUB_STEP_SUMMARY
build-and-release:
needs: prepare
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Sourcecode
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ needs.prepare.outputs.java-version }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-disabled: true
- name: Make gradle wrapper executable
run: chmod +x ./gradlew
- name: Execute Gradle build
run: ./gradlew build
- name: Add files to GitHub-Release
uses: shogo82148/actions-upload-release-asset@v1.7.5
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: |
./forge/build/libs/${{ env.MODID }}-*.jar
./fabric/build/libs/${{ env.MODID }}-*.jar
overwrite: true
- name: Publish Fabric
if: ${{ contains(github.event.release.name, '[RELEASE]') }}
uses: Kir-Antipov/mc-publish@v3.3
with:
modrinth-id: "I8oNjZdJ"
modrinth-featured: true
modrinth-unfeature-mode: intersection
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-name: ${{ needs.prepare.outputs.mc-version }} - ${{ needs.prepare.outputs.mod-version }} - Fabric
modrinth-version: ${{ needs.prepare.outputs.mc-version }}-${{ needs.prepare.outputs.mod-version }}-Fabric
curseforge-id: 565322
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
curseforge-name: ""
curseforge-version: ""
version-type: "release"
loaders: fabric
files: "./fabric/build/libs/${{ env.MODID }}-*.jar"
changelog: "${{ github.event.release.body }}"
game-versions: ${{ needs.prepare.outputs.version-range }}
dependencies: fabric-api(required)
game-version-filter: releases
- name: Publish Forge
if: ${{ contains(github.event.release.name, '[RELEASE]') }}
uses: Kir-Antipov/mc-publish@v3.3
with:
modrinth-id: "I8oNjZdJ"
modrinth-featured: true
modrinth-unfeature-mode: intersection
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-name: ${{ needs.prepare.outputs.mc-version }} - ${{ needs.prepare.outputs.mod-version }} - Forge
modrinth-version: ${{ needs.prepare.outputs.mc-version }}-${{ needs.prepare.outputs.mod-version }}-Forge
curseforge-id: 397255
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
curseforge-name: ""
curseforge-version: ""
version-type: "release"
loaders: forge
files: "./forge/build/libs/${{ env.MODID }}-*.jar"
changelog: "${{ github.event.release.body }}"
game-versions: ${{ needs.prepare.outputs.version-range }}
dependencies: ""
game-version-filter: releases
send-discord-embed:
needs: [ "prepare", "build-and-release" ]
runs-on: ubuntu-latest
steps:
- name: Make embed
uses: tristankechlo/create-discord-embed@v1.1
with:
released: ${{ contains(github.event.release.name, '[RELEASE]') }}
changelog: "${{ github.event.release.body }}"
version: "${{ needs.prepare.outputs.mc-version }} - ${{ needs.prepare.outputs.mod-version }}"
color: 10289039
mod-name: "Tool Leveling+"
mention: "<@&890143376131895296>"
loaders: Forge,Fabric
curseforge: "https://www.curseforge.com/minecraft/mc-mods/tool-leveling-plus"
modrinth: "https://modrinth.com/mod/tool-leveling"
github: ${{ github.event.release.html_url }}
thumbnail: "https://cdn.modrinth.com/data/I8oNjZdJ/1cce579e6f414d356b2ce79786a5db1d55f06f22_96.webp"
- name: Send Discord Message
uses: tsickert/discord-webhook@v6.0.0
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
raw-data: ./embed.json