-
-
Notifications
You must be signed in to change notification settings - Fork 10
120 lines (98 loc) · 4 KB
/
publish.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
name: Publish
on:
workflow_dispatch:
jobs:
build_and_publish:
name: Build and publish
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v3
- name: Get mod version from Gradle
uses: madhead/read-java-properties@latest
id: mod_version
with:
file: gradle.properties
property: mod_version
default: 0.0.1
- name: Get supported Minecraft version from Gradle
uses: madhead/read-java-properties@latest
id: supported_minecraft_version_name
with:
file: gradle.properties
property: supported_minecraft_version_name
default: 0.0.1
- name: Print version string
run: echo version string ${{ steps.mod_version.outputs.value }}+mc${{ steps.supported_minecraft_version_name.outputs.value }}
- name: Set release tag name environment variable
run: echo release_tag_name=v${{ steps.mod_version.outputs.value }}+mc${{ steps.supported_minecraft_version_name.outputs.value }} >> $GITHUB_ENV
- name: Get existing release
uses: cardinalby/git-get-release-action@v1
id: get_existing_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ env.release_tag_name }}
doNotFailIfNotFound: true
- name: Check if an existing release with the same version exists
if: steps.get_existing_release.outputs.tag_name == env.release_tag_name
run: exit 1
- name: Setup JDK (Temurin 17)
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Change Gradle wrapper permissions
run: chmod +x ./gradlew
- name: Execute Gradle build
run: ./gradlew build
# https://github.com/marketplace/actions/mc-publish
- name: Publish mod (Fabric)
uses: Kir-Antipov/mc-publish@v3.3
with:
# Modrinth
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
# CurseForge
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
name: ${{ steps.mod_version.outputs.value }} (${{ steps.supported_minecraft_version_name.outputs.value }})
github-tag: ${{ env.release_tag_name }}
files: |
fabric/build/libs/!(*-@(sources|dev-shadow|javadoc|transformProduction*).jar)
fabric/build/libs/*-@(sources|javadoc).jar
version-type: release
modrinth-featured: false
changelog-file: CHANGELOG_LATEST.md
# https://github.com/marketplace/actions/mc-publish
- name: Publish mod (NeoForge)
uses: Kir-Antipov/mc-publish@v3.3
with:
# Modrinth
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
# CurseForge
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
name: ${{ steps.mod_version.outputs.value }} (${{ steps.supported_minecraft_version_name.outputs.value }})
github-tag: ${{ env.release_tag_name }}
files: |
neoforge/build/libs/!(*-@(sources|dev-shadow|javadoc|transformProduction*).jar)
neoforge/build/libs/*-@(sources|javadoc).jar
version-type: release
modrinth-featured: false
changelog-file: CHANGELOG_LATEST.md
- name: Publish mod to GitHub releases
uses: ncipollo/release-action@v1.14.0
with:
name: ${{ steps.mod_version.outputs.value }} (${{ steps.supported_minecraft_version_name.outputs.value }})
tag: ${{ env.release_tag_name }}
artifacts: "**/build/libs/!(*-@(dev-shadow|transformProduction*).jar)"
bodyFile: CHANGELOG_LATEST.md
- name: Publish mod to Maven repository
run: ./gradlew publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}