-
-
Notifications
You must be signed in to change notification settings - Fork 30
110 lines (93 loc) · 3.87 KB
/
gradle.yml
File metadata and controls
110 lines (93 loc) · 3.87 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
# This workflow will build TARDIS with Gradle
# and upload the JAR file to the latest release
# plus create a version on Modrinth
name: Java CI with Gradle
on:
push:
branches: [ "master" ]
env:
VERSION: '7.0.0'
RELEASE_TAG: '26.1'
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
- name: Get all pushed commits
run: |
MULTI_LINE_CONTENT="`git log --pretty=format:'- [\`%h\`](https://github.com/eccentricdevotion/TARDIS/commit/%H) %s' ${{ github.event.before }}..${{ github.event.after }}`"
echo "GIT_COMMITS<<EOF" >> $GITHUB_ENV
echo "$MULTI_LINE_CONTENT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Set up JDK 25
uses: actions/setup-java@v5.2.0
with:
java-version: '25'
distribution: 'temurin'
# get short sha
- name: Set SHORT_SHA env property
run: echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6.1.0
# set executable permissions on gradlew
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# build and publish to hangar.papermc.io
- name: Build with Gradle Wrapper
env:
HANGAR_API_TOKEN: ${{ secrets.HANGAR_API_TOKEN }}
run: ./gradlew build publishPluginPublicationToHangar
- name: Delete old release assets
uses: mknejp/delete-release-assets@v1
with:
assets: 'TARDIS-*.jar' # filename of asset to delete
tag: "${{ env.RELEASE_TAG }}" # the tag of the release to modify
token: ${{ secrets.TARDIS_WORKFLOW }} # Required for authentication
- name: Upload build artifacts to release
id: update_release
uses: softprops/action-gh-release@v3.0.0
with:
token: ${{ secrets.TARDIS_WORKFLOW }}
tag_name: "${{ env.RELEASE_TAG }}"
files: build/libs/TARDIS-${{ env.VERSION }}-b${{ env.SHORT_SHA }}.jar
fail_on_unmatched_files: false
body: "${{ env.GIT_COMMITS }}"
append_body: true
- name: Modrinth Publish
uses: cloudnode-pro/modrinth-publish@v2.3.3
with:
token: ${{ secrets.MODRINTH_TOKEN }} # Modrinth API token
project: 'ymLTIuUH' # ID of the project this version is for
name: "TARDIS ${{ env.VERSION }}-b${{ env.SHORT_SHA }}"
version: "${{ env.VERSION }}-b${{ env.SHORT_SHA }}"
changelog: "${{ env.GIT_COMMITS }}" # The changelog for this version
# mod loaders that this version supports
loaders: |-
paper
# list of versions of Minecraft that this version supports
game-versions: |-
${{ env.RELEASE_TAG }}
# list of file paths to upload
files: |-
build/libs/TARDIS-${{ env.VERSION }}-b${{ env.SHORT_SHA }}.jar
- name: Get current date
id: date
run: |
echo "today=$(date +'%d %B %Y %H:%M')" >> $GITHUB_OUTPUT
- name: Send Discord notification
uses: stegzilla/discord-notify@v4
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}
title: TARDIS Plugin Update
message: "TARDIS-${{ env.VERSION }}-b${{ env.SHORT_SHA }} is now available!\nReleased ${{ steps.date.outputs.today }}\n${{ env.GIT_COMMITS }}\n[View on GitHub](${{ steps.update_release.outputs.url }})\n[View on Modrinth](https://modrinth.com/plugin/tardis/version/${{ env.VERSION }}-b${{ env.SHORT_SHA }})"
include_image: true
colour: "#D4AF37"
avatar_url: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
username: TARDIS GitHub Notifier