Merge pull request #697 from rbasamoyai/multiversion #112
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
name: Nightly Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "**" | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get branch name | |
id: get_branch | |
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | |
- name: Get MC version and mod version | |
uses: christian-draeger/read-properties@908f99d3334be3802ec7cb528395a69d19914e7b | |
id: read_properties | |
with: | |
path: gradle.properties | |
properties: mod.version minecraft_version archives_base_name | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Validate Gradle wrapper | |
uses: gradle/actions/wrapper-validation@v3 | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Set up Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-home-cache-includes: | | |
caches | |
loom-cache | |
- name: Build jar | |
run: ./gradlew chiseledBuild | |
- name: Publish to Maven Repository | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
MAVEN_USER: ${{ secrets.MAVEN_USER }} | |
MAVEN_ACCESS_TOKEN: ${{ secrets.MAVEN_ACCESS_TOKEN }} | |
if: env.MAVEN_USER != '' && env.MAVEN_ACCESS_TOKEN != '' && env.GITHUB_TOKEN != '' | |
run: ./gradlew chiseledPublish -PrealRobotixMavenUsername=${{ secrets.MAVEN_USER }} -PrealRobotixMavenPassword=${{ secrets.MAVEN_ACCESS_TOKEN }} | |
- name: Find jars | |
id: find_jars | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "jars<<$EOF" >> $GITHUB_OUTPUT | |
find ./build/libs/ -type f -name "*.jar" ! -name "*-sources.jar" >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
- name: Send building message to discord | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
if: env.DISCORD_WEBHOOK != '' && github.event_name == 'push' | |
uses: realRobotix/action-discord-notifier@master | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
message-title: Building mod from branch ${{ steps.get_branch.outputs.branch }} | |
- name: Send built file to discord | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
if: env.DISCORD_WEBHOOK != '' | |
run: | | |
while IFS= read -r f | |
do curl -F "file=@\"$f\";filename=\"$(echo ${f##*/} | sed 's/+/-/g')\"" $DISCORD_WEBHOOK | |
done <<< "${{ steps.find_jars.outputs.jars }}" | |
- name: Archive Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.read_properties.outputs.mod.id }}-${{ steps.read_properties.outputs.mod.version }}+build.${{ github.run_number }} | |
path: ${{ steps.find_jars.outputs.jars }} |