-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upload releases using platform plugins (#81)
- Loading branch information
Showing
7 changed files
with
217 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Hangar release | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
version: | ||
name: Detect version | ||
uses: ./.github/workflows/version.yml | ||
upload: | ||
name: Build and upload | ||
needs: version | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
version: ${{ needs.version.outputs.version }} | ||
env: | ||
HANGAR_UPLOAD: true | ||
HANGAR_TOKEN: ${{ secrets.HANGAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,40 +6,12 @@ jobs: | |
version: | ||
name: Detect version | ||
uses: ./.github/workflows/version.yml | ||
build: | ||
name: Build | ||
upload: | ||
name: Build and upload | ||
needs: version | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
version: ${{ needs.version.outputs.version }} | ||
upload: | ||
name: Upload | ||
needs: | ||
- version | ||
- build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Download build artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: gradle-build | ||
- name: Read VERSIONS.txt | ||
id: supported_versions | ||
uses: juliangruber/read-file-action@v1 | ||
with: | ||
path: ./VERSIONS.txt | ||
- uses: Kir-Antipov/[email protected] | ||
with: | ||
name: ${{ needs.version.outputs.version }} | ||
version: ${{ needs.version.outputs.version }} | ||
files: ${{ needs.build.outputs.artifact }} | ||
version-type: ${{ needs.version.outputs.release-type }} | ||
changelog: | | ||
Changelog is available on | ||
[GitHub](https://github.com/turikhay/MapModCompanion/releases/tag/v${{ needs.version.outputs.version }}) | ||
game-versions: ${{ steps.supported_versions.outputs.content }} | ||
loaders: bukkit spigot paper bungeecord waterfall velocity | ||
modrinth-id: UO7aDcrF | ||
modrinth-featured: ${{ needs.version.outputs.pre-release != true }} | ||
modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | ||
env: | ||
MODRINTH_UPLOAD: true | ||
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.file.RegularFileProperty | ||
import org.gradle.api.tasks.* | ||
|
||
abstract class PlatformReadmeTask : DefaultTask() { | ||
companion object { | ||
val PLATFORM_START = "<!-- platform.start -->" | ||
val PLATFORM_END = "<!-- platform.end -->" | ||
} | ||
|
||
@get:InputFile | ||
@get:Optional | ||
abstract val inputFile: RegularFileProperty | ||
|
||
@get:OutputFile | ||
@get:Optional | ||
abstract val outputFile: RegularFileProperty | ||
|
||
init { | ||
inputFile.convention(project.objects.fileProperty().fileValue( | ||
project.rootProject.file("README.md")) | ||
) | ||
outputFile.convention(project.objects.fileProperty().value( | ||
project.layout.buildDirectory.file("README-platform.md")) | ||
) | ||
} | ||
|
||
@TaskAction | ||
fun writeFile() { | ||
inputFile.get().asFile.reader().use { reader -> | ||
outputFile.get().asFile.writer().use { writer -> | ||
reader.useLines { lines -> | ||
var blockAtLineIndex = -1 | ||
for (indexed in lines.withIndex()) { | ||
val lineIndex = indexed.index | ||
val line = indexed.value | ||
if (line == PLATFORM_START) { | ||
blockAtLineIndex = lineIndex | ||
continue | ||
} | ||
if (line == PLATFORM_END) { | ||
blockAtLineIndex = -1 | ||
continue | ||
} | ||
if (blockAtLineIndex > 0) { | ||
continue | ||
} | ||
writer.write(line) | ||
writer.write("\n") | ||
} | ||
if (blockAtLineIndex > 0) { | ||
throw IllegalArgumentException("platform.start block was never closed " + | ||
"(see line ${blockAtLineIndex + 1})") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters