update GitHub Actions workflows for nightly builds and release publishing

This commit is contained in:
2025-01-01 14:37:13 -06:00
parent 4b77d1fbce
commit 22d7ee7d94
2 changed files with 52 additions and 9 deletions

View File

@@ -1,12 +1,8 @@
name: Build and Upload JAR
name: Nightly Builds
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '0 0 * * *' # Runs at midnight UTC every day
jobs:
build:
@@ -28,8 +24,11 @@ jobs:
- name: Build with Gradle
run: ./gradlew build
- name: Rename build artifact
run: mv build/libs/*.jar build/libs/nuggetmod-nightly.jar
- name: Upload build artifacts
uses: actions/upload-artifact@v4.5.0
with:
name: build-jar-mod
path: build/libs/*.jar
name: nuggetmod-nightly
path: build/libs/nuggetmod-nightly.jar

44
.github/workflows/publish.yml vendored Normal file
View File

@@ -0,0 +1,44 @@
name: Build and Upload JAR
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4.6.0
with:
distribution: 'temurin'
java-version: '21'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Update mod_version in gradle.properties
run: |
sed -i "s/^mod_version=.*$/mod_version=${{ github.event.release.tag_name }}/" gradle.properties
- name: Build with Gradle
run: ./gradlew build
- name: Upload to Modrinth
uses: cloudnode-pro/modrinth-publish@2.0.0
with:
# Configure the action as needed. The following is an example.
token: ${{ secrets.MODRINTH_TOKEN }}
project: nuggetmod
name: ${{ github.event.release.name }}
version: ${{ github.event.release.tag_name }}
changelog: ${{ github.event.release.body }}
loaders: |-
forge
game-versions: |-
1.21.x
files: build/libs/*.jar