Skip to content

Commit

Permalink
ci: hangar version preview tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
rxchard committed Dec 11, 2024
1 parent 11e2ab2 commit 32066a5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v4

- id: shorty
run: echo "shorty=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- uses: actions/setup-java@v4
with:
java-version: '17'
Expand All @@ -27,6 +30,7 @@ jobs:
HANGAR_ID: ${{ secrets.HANGAR_ID }}
HANGAR_PLATFORM_VERSIONS: ${{ secrets.HANGAR_PLATFORM_VERSIONS }}
HANGAR_PUB_CHANNEL: ${{ github.ref == 'refs/heads/master' && 'Preview' || 'Release' }}
HANGAR_SHORTY: ${{ steps.shorty.outputs.shorty }}

- uses: actions/upload-artifact@v4
with:
Expand Down
13 changes: 11 additions & 2 deletions Publication/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,22 @@ var plugin = project(":Plugin")
// com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar ext org.gradle.api.tasks.bundling.Jar
var shadowJar = plugin.tasks.named<Jar>("shadowJar")

var version = plugin.version as String
var channel = System.getenv("HANGAR_PUB_CHANNEL")
var shorty = System.getenv("HANGAR_SHORTY")

if (channel == "Preview") {
version += "+"
version += shorty
}

hangarPublish {
publications.register("plugin") {
apiKey.set(System.getenv("HANGAR_API_TOKEN"))
id.set(System.getenv("HANGAR_ID"))
channel.set(System.getenv("HANGAR_PUB_CHANNEL"))
channel.set(channel)
changelog.set(System.getenv("HANGAR_PUB_CHANGELOG"))
version.set(plugin.version as String)
version.set(version)
platforms {
register(Platforms.PAPER) {
jar.set(shadowJar.flatMap { it.archiveFile })
Expand Down

0 comments on commit 32066a5

Please sign in to comment.