Skip to content

Commit 42ee597

Browse files
committed
Add Hangar publishing
Affects issues: - #2906
1 parent 074255f commit 42ee597

2 files changed

Lines changed: 59 additions & 2 deletions

File tree

.github/workflows/on-release.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout 🛎️
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414
- name: Get Download URL
1515
run: |
1616
curl 'https://api.github.com/repos/plan-player-analytics/plan/releases/${{ github.event.release.id }}/assets' | jq -r '.[] | {name: .name, url: .browser_download_url} | select(.url | strings | test("Fabric") | not)' > asset.txt
@@ -43,7 +43,7 @@ jobs:
4343

4444
steps:
4545
- name: Checkout 🛎️
46-
uses: actions/checkout@v3
46+
uses: actions/checkout@v4
4747
- name: Get git TAG
4848
id: tagName
4949
uses: olegtarasov/get-tag@v2.1
@@ -136,3 +136,30 @@ jobs:
136136
game_versions: "2:Java 21,77784:1.21.9,77784:1.21.10,77784:1.21.11,68441:Fabric"
137137
release_type: beta
138138
relations: fabric-api:requiredDependency,luckperms:optionalDependency
139+
140+
upload_release_hangar:
141+
name: Hangar Upload
142+
runs-on: ubuntu-latest
143+
steps:
144+
- name: 📥 Checkout git repository
145+
uses: actions/checkout@v4
146+
with:
147+
fetch-depth: 0
148+
- name: ⚙ Get Download URL
149+
run: |
150+
curl 'https://api.github.com/repos/plan-player-analytics/plan/releases/${{ github.event.release.id }}/assets' | jq -r '.[] | {name: .name, url: .browser_download_url} | select(.url | strings | test("Fabric") | not)' > asset.txt
151+
jq -r '.url' asset.txt > url.txt
152+
echo "RELEASE_DOWNLOAD_URL=$(cat url.txt)" >> $GITHUB_ENV
153+
- name: ☕ Setup JDK
154+
uses: actions/setup-java@v4
155+
with:
156+
distribution: 'temurin'
157+
java-version: '25'
158+
- name: Publish release to Hangar 🚀
159+
env:
160+
HANGAR_API_TOKEN: ${{ secrets.HANGAR_API_TOKEN }}
161+
RELEASE_CHANGELOG: ${{ github.event.release.body }}
162+
RELEASE_PRERELEASE: ${{ github.event.release.prerelease }}
163+
RELEASE_DOWNLOAD_URL: ${{ env.RELEASE_DOWNLOAD_URL }}
164+
run: |
165+
./gradlew :plugin:publishPluginPublicationToHangar

Plan/plugin/build.gradle

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
22

3+
plugins {
4+
id "io.papermc.hangar-publish-plugin" version "0.1.4"
5+
}
6+
37
apply plugin: "com.gradleup.shadow"
48

59
logger.lifecycle("Building artifact for version $fullVersion / $fullVersionFilename / $fullVersionSemantic")
@@ -117,3 +121,29 @@ publishing {
117121
}
118122
}
119123
}
124+
125+
hangarPublish {
126+
publications.register("plugin") {
127+
version = project.fullVersionSemantic
128+
id = "Plan-Player-Analytics"
129+
channel = providers.environmentVariable("RELEASE_PRERELEASE").map { it == "true" ? "Snapshot" : "Release" }.orElse("Release")
130+
changelog = providers.environmentVariable("RELEASE_CHANGELOG")
131+
apiKey = providers.environmentVariable("HANGAR_API_TOKEN")
132+
def downloadUrl = providers.environmentVariable("RELEASE_DOWNLOAD_URL")
133+
134+
platforms {
135+
paper {
136+
url = downloadUrl
137+
platformVersions = ["1.13-1.21.11"]
138+
}
139+
waterfall {
140+
url = downloadUrl
141+
platformVersions = ["1.13-1.21"]
142+
}
143+
velocity {
144+
url = downloadUrl
145+
platformVersions = ["3.5"]
146+
}
147+
}
148+
}
149+
}

0 commit comments

Comments
 (0)