-
-
Notifications
You must be signed in to change notification settings - Fork 32
137 lines (117 loc) · 4.54 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
130
131
132
133
134
135
136
137
name: Publish Release
on:
workflow_dispatch:
inputs:
patch:
description: "Patch version"
required: true
type: string
release-type:
description: "Release Type"
required: true
type: choice
options:
- release
- alpha
- beta
- pre
- rc
default: release
build:
description: "Build"
required: true
type: string
default: "0"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.TEAM_RESOURCEFUL_BOT }}
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Set Gradle Perms
run: chmod +x gradlew
- name: Update Mod Version
run: ./gradlew updateModVersion --patch=${{ inputs.patch }} --releaseType=${{ inputs.release-type }} --build=${{ inputs.build }}
- name: Get Mod Version
id: version
uses: christian-draeger/read-properties@1.1.1
with:
path: "./version.properties"
properties: "version"
- name: Get MC Version
id: props
uses: christian-draeger/read-properties@1.1.1
with:
path: "./gradle.properties"
properties: "mc_version enabled_platforms"
- name: Publish package
run: ./gradlew publish --info
env:
MAVEN_USER: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASS: ${{ secrets.MAVEN_PASSWORD }}
#- name: Update Changelog
# uses: Team-Resourceful/ResourcefulChangelog@v0.0.1
# with:
# release_version: ${{ steps.version.outputs.version }}
# github_token: ${{ secrets.TEAM_RESOURCEFUL_BOT }}
### Need to duplicate this block for fabric or abuse the files-secondary field
- name: Upload Forge Releases (Curse/Modrinth/Github)
if: contains(steps.props.outputs.enabled_platforms, 'forge')
uses: Kir-Antipov/mc-publish@v3.2
with:
curseforge-id: ${{ vars.CURSE_ID }}
curseforge-token: ${{ secrets.CURSE_API_KEY }}
modrinth-id: ${{ vars.MODRINTH_ID }}
modrinth-token: ${{ secrets.MODRINTH_API_KEY }}
github-tag: "v${{ steps.version.outputs.version }}-forge"
github-token: ${{ secrets.TEAM_RESOURCEFUL_BOT }}
files: ./forge/build/libs/!(*-@(dev|sources|dev-shadow)).jar
name: "[Forge] Resourceful Bees ${{ steps.version.outputs.version }}"
version: ${{ steps.version.outputs.version }}
changelog-file: changelog.md
loaders: forge
game-versions: ${{ steps.props.outputs.mc_version }}
version-resolver: exact
- name: Upload Fabric Releases (Curse/Modrinth/Github)
if: contains(steps.props.outputs.enabled_platforms, 'fabric')
uses: Kir-Antipov/mc-publish@v3.2
with:
curseforge-id: ${{ vars.CURSE_ID }}
curseforge-token: ${{ secrets.CURSE_API_KEY }}
modrinth-id: ${{ vars.MODRINTH_ID }}
modrinth-token: ${{ secrets.MODRINTH_API_KEY }}
github-tag: "v${{ steps.version.outputs.version }}-fabric"
github-token: ${{ secrets.TEAM_RESOURCEFUL_BOT }}
files: ./fabric/build/libs/!(*-@(dev|sources|dev-shadow)).jar
name: "[Fabric] Resourceful Bees ${{ steps.version.outputs.version }}"
version: ${{ steps.version.outputs.version }}
changelog-file: changelog.md
loaders: fabric
game-versions: ${{ steps.props.outputs.mc_version }}
version-resolver: exact
- name: Update Readme
run: |
./gradlew injectReadme
mv -f ./build/README.md .
- name: Create Discord Embed
run: ./gradlew injectDiscordEmbed --escapeBackslash
- name: Commit Version Updates
run: |
git config --global user.name "TeamResourcefulBot"
git config --global user.email "teamresourcefulbot@users.noreply.github.com"
git diff-index --quiet HEAD || { git commit -am "Released v${{ steps.version.outputs.version }}"; git push; }
- name: Send Discord Webhook
run: |
curl -H "Content-Type: application/json" -d @./build/release_embed.json ${{ secrets.DISCORD_RELEASE_WEBHOOK }}