added discord banner url #6
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: Release | |
| on: | |
| push: | |
| tags: | |
| - '*.*.*-*.*.*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| validate: | |
| name: Validate Structures | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout mod project | |
| uses: actions/checkout@v6 | |
| with: | |
| path: project | |
| - name: Checkout validator | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: FinnSetchell/moogs-structure-validator | |
| ref: v1 | |
| path: validator | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: pip install -r validator/requirements.txt | |
| - name: Run validator | |
| run: python validator/validator.py --config project/validator.json --project-root project | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: validate | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Java 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| - name: Build | |
| shell: bash | |
| run: | | |
| set -eo pipefail | |
| chmod +x gradlew | |
| ./gradlew build | |
| echo "---- build/libs contents ----" | |
| ls -la build/libs/ | |
| - name: Extract Changelog | |
| id: changelog | |
| shell: bash | |
| run: | | |
| VERSION="${GITHUB_REF_NAME%%-*}" | |
| BODY=$(python3 -c " | |
| import re, sys | |
| content = open('CHANGELOG.md').read() | |
| m = re.search(r'## \[' + re.escape(sys.argv[1]) + r'\] - \d{4}-\d{2}-\d{2}\r?\n(.*?)(?=\r?\n---|## \[|\Z)', content, re.DOTALL) | |
| print(m.group(1).strip() if m else '') | |
| " "$VERSION") | |
| printf "body<<DELIMITER\n%s\nDELIMITER\n" "$BODY" >> "$GITHUB_OUTPUT" | |
| - name: Post Discord Banner | |
| shell: bash | |
| run: | | |
| BANNER_URL=$(grep 'discordBannerUrl=' gradle.properties | cut -d'=' -f2) | |
| ROLE_ID=$(grep 'discordRoleId=' gradle.properties | cut -d'=' -f2) | |
| AVATAR_URL=$(grep 'discordAvatarUrl=' gradle.properties | cut -d'=' -f2) | |
| curl -X POST "$DISCORD_WEBHOOK" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"username\":\"Moog's Mods\",\"avatar_url\":\"$AVATAR_URL\",\"content\":\"<@&$ROLE_ID>\\n$BANNER_URL\",\"allowed_mentions\":{\"parse\":[],\"roles\":[\"$ROLE_ID\"]}}" | |
| env: | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
| - name: Publish to CurseForge, Modrinth & Discord | |
| shell: bash | |
| run: | | |
| set -eo pipefail | |
| chmod +x gradlew | |
| ./gradlew publishMods | |
| env: | |
| MODRINTH_API_KEY: ${{ secrets.MODRINTH_API_KEY }} | |
| CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }} | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| body: ${{ steps.changelog.outputs.body }} | |
| files: | | |
| build/libs/*.jar | |
| fail_on_unmatched_files: true | |
| - name: Bump patch version for next release | |
| if: success() | |
| shell: bash | |
| run: | | |
| MC=$(grep '^minecraftVersion=' gradle.properties | cut -d= -f2) | |
| BRANCH="${MC}-datapack" | |
| TODAY=$(date -u +%Y-%m-%d) | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git fetch origin "$BRANCH" | |
| git checkout "$BRANCH" | |
| OLD=$(grep '^modVersion=' gradle.properties | cut -d= -f2) | |
| IFS='.' read -r -a P <<< "$OLD" | |
| NEW="${P[0]}.${P[1]}.$((P[2]+1))" | |
| sed -i "s|^modVersion=.*$|modVersion=${NEW}|" gradle.properties | |
| NEW_VERSION="$NEW" RELEASE_DATE="$TODAY" python3 .github/scripts/post_release_bump.py | |
| git add gradle.properties CHANGELOG.md | |
| git commit -m "Post-release: bump ${OLD} → ${NEW} + stub CHANGELOG section" | |
| git push origin "$BRANCH" |