Build Release #71
Workflow file for this run
This file contains hidden or 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 Release | |
| # Controls when the action will run. | |
| # Releases should be created manually by running this workflow. | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'microsoft' | |
| java-version: '21' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Build with Gradle | |
| run: ./gradlew build | |
| - name: Process artifacts | |
| uses: actions/github-script@v7 | |
| id: fname | |
| with: | |
| result-encoding: string | |
| script: | | |
| const fs = require("fs") | |
| return fs.readdirSync("build/libs/").filter(e => !e.endsWith("dev.jar") && !e.endsWith("sources.jar") && e.endsWith(".jar"))[0].replace(".jar", ""); | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.fname.outputs.result }} | |
| path: build/libs/ | |
| - name: Read Changelog | |
| id: read_changelog | |
| shell: bash | |
| run: | | |
| CHANGELOG=$(sed '/___/Q' CHANGELOG.md) | |
| CHANGELOG=$(echo "$CHANGELOG" | sed 1d) | |
| # changelog for Github release | |
| delimiter="$(openssl rand -hex 8)" | |
| { | |
| echo "changelog<<${delimiter}" | |
| echo "$CHANGELOG" | |
| echo "${delimiter}" | |
| } >> $GITHUB_OUTPUT | |
| #echo "Changelog:\n$CHANGELOG" # for debugging | |
| changelog="${CHANGELOG}" | |
| highlight_section=$(echo "$changelog" | awk '/## Highlight/{flag=1;next}/^$/{flag=0}flag') | |
| highlight_section=$'# Highlight\n'"$highlight_section"$'\n\nhttps://hysky.de/' | |
| # Format highlight_section with printf | |
| highlight_section=$(printf "%s" "$highlight_section") | |
| # Store the highlight_section in the CHANGELOG variable | |
| CHANGELOG=$(echo -n "$highlight_section") | |
| # changelog for rest | |
| delimiter="$(openssl rand -hex 8)" | |
| { | |
| echo "changelog_highlight<<${delimiter}" | |
| echo "$CHANGELOG" | |
| echo "${delimiter}" | |
| } >> $GITHUB_OUTPUT | |
| - name: Publish using mod-publish-plugin | |
| run: ./gradlew build publishMods | |
| env: | |
| CHANGELOG: ${{ steps.read_changelog.outputs.changelog }} | |
| CHANGELOG_HIGHLIGHT: ${{ steps.read_changelog.outputs.changelog_highlight }} | |
| REF_NAME: ${{ github.ref_name }} | |
| GITHUB_TOKEN: ${{ secrets.GH_RELEASE }} | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
| MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | |
| CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} | |
| - name: Trigger Modpack | |
| shell: bash | |
| run: | | |
| curl -X POST -H "Authorization:Bearer ${{secrets.MODPACK_TOKEN}}" -H "X-GitHub-Api-Version:2022-11-28" https://api.github.com/repos/SkyblockerMod/Skyblocker-modpack/actions/workflows/update.yml/dispatches --data '{"ref":"main"}' |