-
-
Notifications
You must be signed in to change notification settings - Fork 534
117 lines (105 loc) · 4.04 KB
/
gradle-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
# This workflow will build a package using Gradle and then publish it to the usual places
name: Build & Publish
on:
push:
branches:
- 'release/**'
jobs:
build:
runs-on: ubuntu-latest
permissions:
#to create releases
contents: write
#for github maven? packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find last successful build (current branch)
id: last_success_build
uses: SamhammerAG/last-successful-build-action@v4
with:
workflow: ${{github.workflow}}
token: ${{github.token}}
#verify ensures that it's reachable on the current branch
verify: true
branch: ${{ github.ref_name }}
- name: Find last successful build (any branch)
id: last_success_build_any
uses: SamhammerAG/last-successful-build-action@v4
with:
workflow: ${{github.workflow}}
token: ${{github.token}}
#verify ensures that it's reachable on the current branch
verify: true
- uses: madhead/read-java-properties@latest
id: gradle_props
with:
file: gradle.properties
all: true
- name: Cache NG outputs
uses: actions/cache@v4
with:
key: ${{ steps.gradle_props.outputs.minecraft_version }}-${{ steps.gradle_props.outputs.forge_version }}
path: |
build/neoForge
build/neoForm
~/.gradle
.gradle
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Build with Gradle
uses: gradle/gradle-build-action@v3
with:
arguments: build outputChangelog
gradle-version: wrapper
cache-read-only: false
env:
BUILD_NUMBER: ${{ github.run_number }}
GIT_COMMIT: ${{ github.sha }}
GIT_PREVIOUS_SUCCESSFUL_COMMIT: ${{ steps.last_success_build.outputs.sha != github.sha && steps.last_success_build.outputs.sha || steps.last_success_build_any.outputs.sha }}
- name: Upload to workflow artifacts
uses: actions/upload-artifact@v4
with:
path: |
build/libs/
build/changelog.html
- name: GH Release
id: gh_release
uses: softprops/action-gh-release@v1
with:
files: build/libs/!(MekanismDefense*).jar
body_path: build/changelog.md
tag_name: v${{ steps.gradle_props.outputs.minecraft_version }}-${{ steps.gradle_props.outputs.mod_version }}.${{ github.run_number }}
target_commitish: ${{ github.sha }}
- name: Publish
uses: gradle/gradle-build-action@v3
with:
arguments: curseforge modrinth publish
gradle-version: wrapper
cache-read-only: false
env:
CURSEFORGE_KEY: ${{ secrets.CURSEFORGE_KEY }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
MEK_MAVEN_PW: ${{ secrets.MEK_MAVEN_PW }}
BUILD_NUMBER: ${{ github.run_number }}
GIT_COMMIT: ${{ github.sha }}
GIT_PREVIOUS_SUCCESSFUL_COMMIT: ${{ steps.last_success_build.outputs.sha != github.sha && steps.last_success_build.outputs.sha || steps.last_success_build_any.outputs.sha }}
- name: Read changelog
id: read_changelog
uses: andstor/file-reader-action@v1
with:
path: "build/changelog.md"
- name: Announce Release
uses: tsickert/[email protected]
with:
webhook-url: ${{ secrets.WEBHOOK_URL }}
embed-title: Mekanism ${{ steps.gradle_props.outputs.mod_version }}.${{ github.run_number }} for Minecraft ${{ steps.gradle_props.outputs.minecraft_version }} Released
embed-url: ${{ steps.gh_release.outputs.url }}
embed-description: |
Available on Curseforge after approval.
${{ steps.read_changelog.outputs.contents }}