feat: add Sweater Outfits #123
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: Build Star Academy Mod | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4.2.2 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4.5.0 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Make Gradle Wrapper Executable | |
run: chmod +x ./gradlew | |
- name: Cache Gradle Files | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/*.gradle.kts*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Publish to Github Packages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: ./gradlew :fabric:build :fabric:publish | |
- name: Retrieve Version | |
id: get_version | |
run: | | |
VERSION_NAME=$(./gradlew -q :fabric:printVersion) | |
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_OUTPUT | |
- name: Print Version | |
run: | | |
echo "Version: ${{ steps.get_version.outputs.VERSION_NAME }}" | |
- name: Compile Version Message | |
id: embed | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const gh = ${{ toJSON(github) }}; | |
core.setOutput('EMBED_TITLE', "[" + gh.event.repository.name + ":" + gh.ref_name +"] New Build [${{steps.get_version.outputs.VERSION_NAME}}]"); | |
core.setOutput('EMBED_URL', "https://github.com/Abes-Hutt/StarAcademyMod/packages/2338941?version=${{steps.get_version.outputs.VERSION_NAME}}"); | |
core.setOutput('EMBED_AUTHOR_NAME', gh.event.sender.login); | |
core.setOutput('EMBED_AUTHOR_ICON_URL', gh.event.sender.avatar_url); | |
const commits = ${{ toJSON(github.event.commits) }}; | |
let description = ""; | |
for(const commit of commits) { | |
if(description.length !== 0) { | |
description += "\n"; | |
} | |
description += " [" + commit.id.slice(0,7) + "](<" + commit.url + ">) " + commit.message + " - " + commit.author.username; | |
} | |
core.setOutput('EMBED_DESCRIPTION', description); | |
- name: Send Discord Notification | |
uses: tsickert/discord-webhook@v5.3.0 | |
with: | |
webhook-url: ${{ secrets.DISCORD_WEBHOOK }} | |
embeds: ${{steps.embed.outputs.EMBEDS}} | |
content: null | |
embed-title: "${{steps.embed.outputs.EMBED_TITLE}}" | |
embed-url: "${{steps.embed.outputs.EMBED_URL}}" | |
embed-description: "${{steps.embed.outputs.EMBED_DESCRIPTION}}" | |
embed-author-name: "${{steps.embed.outputs.EMBED_AUTHOR_NAME}}" | |
embed-author-icon-url: "${{steps.embed.outputs.EMBED_AUTHOR_ICON_URL}}" | |
embed-color: 58633 | |
- name: Cleanup Old Artifacts | |
uses: actions/delete-package-versions@v5 | |
with: | |
package-name: "abeshutt.staracademy" | |
min-versions-to-keep: 10 | |
package-type: 'maven' |