Skip to content

Commit

Permalink
add GH actions scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Jan 16, 2025
1 parent 7646c26 commit e472bd2
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build_status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build Status

on:
push:
branches: ['*']
pull_request:

env:
JAVA_VERSION: 21
BUILD_NUMBER: ${{ github.run_number }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build --rerun-tasks
- name: Upload build artifacts (Fabric)
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-Fabric-${{ github.sha }}
path: |
build/libs/*.jar
!build/libs/*-dev.jar
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Upload Release Artifacts

on:
push:
tags:
- '*'

env:
JAVA_VERSION: 21
TAG: ${{ github.ref_name }}
BUILD_NUMBER: ${{ github.run_number }}
MAVEN_UPLOAD_URL: ${{ secrets.MAVEN_UPLOAD_URL }}
MAVEN_UPLOAD_USERNAME: ${{ secrets.MAVEN_UPLOAD_USERNAME }}
MAVEN_UPLOAD_PASSWORD: ${{ secrets.MAVEN_UPLOAD_PASSWORD }}

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: ${{ env.JAVA_VERSION }}
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Get current time
uses: srfrnk/current-time@5a4163ad035ccd9a407ec9e519c3b6ba1b633d1e
id: current_time
with:
format: YY.MMDD.HHmm
- name: Build with Gradle
env:
BUILD_TIME: ${{ steps.current_time.outputs.formattedTime }}
run: ./gradlew assemble --rerun-tasks
- name: Maven Release
if: ${{ env.MAVEN_UPLOAD_URL }}
env:
BUILD_TIME: ${{ steps.current-time.outputs.formattedTime }}
run: ./gradlew publish --rerun-tasks
- name: Publish (GitHub Releases)
uses: Kir-Antipov/mc-publish@995edadc13559a8b28d0b7e6571229f067ec7659
with:
github-token: ${{ github.token }}
files: |
build/libs/!(*-@(dev|sources|javadoc|slim)).jar
build/libs/*-@(sources|javadoc).jar
- name: Publish (Fabric)
id: publish_fabric
uses: Kir-Antipov/mc-publish@995edadc13559a8b28d0b7e6571229f067ec7659
with:
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
version: ${{ env.TAG }}+Fabric
version-type: beta
files: |
build/libs/!(*-@(dev|sources|javadoc|slim)).jar
build/libs/*-@(sources|javadoc).jar
- name: Notify Discord
uses: Up-Mods/action-discord-release@main
with:
version: ${{ env.TAG }}
webhook-url: ${{ secrets.ANNOUNCEMENT_WEBHOOK_URL }}
curseforge-project-id: ${{ steps.publish_fabric.outputs.curseforge-id }}
modrinth-project-id: ${{ steps.publish_fabric.outputs.modrinth-id }}
thumbnail-url: https://mod-assets.upcraft.dev/promo/hookshot/icon_128x.png

0 comments on commit e472bd2

Please sign in to comment.