This repository has been archived by the owner on Aug 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
129 lines (110 loc) · 4.11 KB
/
release.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
name: Release
on:
workflow_dispatch:
push:
tags:
- 'v1.18-*.*.*'
env:
JAVA_DIST: 'zulu'
JAVA_VERSION: 17
MOD_ID: 'lazierae2'
MOD_NAME: 'LazierAE2'
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v3
- name: Check Secrets
run: |
if [ -z "${{ secrets.MODRINTH_TOKEN }}" ]; then
echo "MODRINTH_TOKEN is not set"
exit 1
fi
if [ -z "${{ secrets.CURSEFORGE_TOKEN }}" ]; then
echo "CURSEFORGE_TOKEN is not set"
exit 1
fi
- name: Validate Modrinth Token
run: |
if [ -n "$(curl -s -H "Authorization: ${{ secrets.MODRINTH_TOKEN }}" https://api.modrinth.com/v2/user | grep "unauthorized")" ]; then
echo "Modrinth Token is invalid!"
exit 1
fi
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DIST }}
cache: gradle
- name: Cleanup Gradle Cache
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- name: Make Gradle executable
run: chmod +x ./gradlew
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
# - name: Check existing DataGen
# run: |
# test -d ./src/generated -a -f ./src/generated/resources/.cache/cache
# echo "cache_exists=$?" >> $GITHUB_ENV
#
# - name: Save old DataGen state
# if: ${{ env.cache_exists }}
# run: mv ./src/generated/resources/.cache ./src/generated/cache_old
#
# - name: Generate assets
# run: ./gradlew runData --stacktrace
#
# - name: Validate assets
# if: ${{ env.cache_exists }}
# run: diff -q ./src/generated/cache_old/cache ./src/generated/resources/.cache/cache
- name: Assemble the jar
run: ./gradlew assemble
- name: Collect version information
run: |
shopt -s failglob # print a warning if a glob does not match anything
set_var() {
echo $1="$2"
echo $1="$2" >> $GITHUB_ENV
declare -g $1="$2"
}
set_var JAR_FILE $(eval echo build/libs/${{ env.MOD_ID }}-*-*.jar)
set_var MINECRAFT_VERSION $(echo ${JAR_FILE%.*} | cut -d- -f2)
set_var MOD_VERSION $(echo ${JAR_FILE%.*} | cut -d- -f3)
set_var RELEASE_TYPE "$(echo ${GITHUB_REF##*/} | cut -d- -f3)"
set_var RELEASE_TYPE "$([[ -z $RELEASE_TYPE ]] && echo release || echo $RELEASE_TYPE)"
- name: Install changelog parser
uses: taiki-e/install-action@parse-changelog
- name: Parse changelog
run: parse-changelog CHANGELOG.md ${{ env.MOD_VERSION }} > changes.md
- name: Release
uses: Kir-Antipov/[email protected]
with:
curseforge-id: 489843
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
modrinth-id: 7mmL0PW9
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
files: ${{ env.JAR_FILE }}
name: ${{ env.MOD_NAME }}-${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}
github-name: v${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}
loaders: forge
game-versions: ${{ env.MINECRAFT_VERSION }}
version: ${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}
version-type: ${{ env.RELEASE_TYPE }}
version-resolver: exact
java: ${{ env.JAVA_VERSION }}
changelog-file: changes.md
curseforge-dependencies: |
applied-energistics-2 | depends | *
jei | suggests | *
crafttweaker | suggests | *
kubejs | suggests | *
modrinth-dependencies: |
ae2 | depends | *
kubejs | suggests | *
retry-attempts: 2
retry-delay: 10000