Skip to content

Commit

Permalink
Add publish gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernasss12 committed Apr 21, 2024
1 parent 4014a3a commit 6ee2983
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 27 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/gradle.yml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Publish a commit version to Modrinth, Curseforge and Github.

on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to Run On'
required: true
default: 'mc-1.20-kotlin'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin

- name: Fetch mod properties
uses: BrycensRanch/read-properties-action@v1
id: properties
with:
file: gradle.properties
all: true

- name: Check for Kotlin
id: kotlin_check
run: |
if [[ -n "${{ steps.properties.outputs.kotlin_version }}" ]]; then
echo "::set-output name=kotlin::[Kotlin]"
else
echo "::set-output name=kotlin::"
fi
- name: Build
run: ./gradlew clean build

- name: Publish mod
uses: Kir-Antipov/[email protected]
with:
modrinth-id: yjpXhps7
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-unfeature-mode: subset

curseforge-id: 369122
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}

github-token: ${{ secrets.GITHUB_TOKEN }}

name: "[${{ steps.properties.outputs.archives_minecraft_version }}]${{ steps.kotlin_check.outputs.kotlin }} Better Enchanted Books ${{ steps.properties.outputs.mod_version }}"
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ version = project.mod_version
group = project.maven_group

base {
archivesName = project.archives_base_name + "-" + project.minecraft_version
archivesName = project.archives_base_name + "-" + project.archives_minecraft_version
}

dependencies {
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ cloth_config_version=13.0.121
# Mod Properties
mod_version=1.4.5
maven_group=dev.bernasss12

# Archive name properties
archives_base_name=better-enchanted-books
archives_minecraft_version=1.20+

java_version=17
minecraft_version_range=>=1.20
Expand Down

0 comments on commit 6ee2983

Please sign in to comment.