Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
Enable Ore deployments for v2
Browse files Browse the repository at this point in the history
  • Loading branch information
dualspiral committed May 17, 2022
1 parent 367ad69 commit 095120f
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
69 changes: 69 additions & 0 deletions .github/workflows/deployToOre.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release to Ore and GH Releases

on:
push:
tags:
- '[2-9]*'
workflow_dispatch:

env:
NUCLEUS_CHANGELOG_NAME: "changelog"

jobs:
buildAndPublish:
runs-on: ubuntu-latest
environment: ore
steps:
- uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Build
run: ./gradlew clean build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: plugin
path: 'output/*-plugin.jar'
if-no-files-found: error
- name: Upload Description
uses: actions/upload-artifact@v3
with:
name: changelog
path: 'output/changelog.md'
if-no-files-found: error
- name: Upload to Ore
uses: dualspiral/ore-upload-action@v2
with:
plugin: plugin
description: changelog
apiKey: ${{ secrets.ORE_API_KEY }}
pluginId: "nucleus"
- name: Upload to Github Releases
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
prerelease: ${{ contains(github.ref, 'BETA') || contains(github.ref, 'ALPHA') || contains(github.ref, 'RC') || contains(github.ref, 'PR') }}
body_path: output/changelog.md
files: output/*.jar
- name: Get tag
id: tagval
uses: mad9000/actions-find-and-replace-string@2
if: startsWith(github.ref, 'refs/tags/')
with:
source: ${{ github.ref }}
find: 'refs/tags/'
replace: ''
- name: Notify Discord
uses: sarisia/actions-status-discord@v1
if: startsWith(github.ref, 'refs/tags/')
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
nodetail: true
title: Nucleus ${{ steps.tagval.outputs.value }} has been released!
description: 'Download it from Ore by clicking here!'
url: https://ore.spongepowered.org/Nucleus/Nucleus/versions/${{ steps.tagval.outputs.value }}
color: 0x00ff40
6 changes: 5 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ val writeRelNotes by tasks.registering {
val outputRelNotes by tasks.registering {
dependsOn(relNotes)
doLast {
Files.write(project.projectDir.toPath().resolve("output").resolve("${nucVersion}.md"),
val parentDirectory = project.projectDir.toPath().resolve("output")
Files.createDirectories(parentDirectory)

val filename = System.getenv("NUCLEUS_CHANGELOG_NAME") ?: nucleusVersion
Files.write(project.projectDir.toPath().resolve("output").resolve("${filename}.md"),
relNotes.get().relNotes!!.toByteArray(StandardCharsets.UTF_8))
}
}
Expand Down

0 comments on commit 095120f

Please sign in to comment.