Skip to content

Fix changelog merging across MC versions #3

Fix changelog merging across MC versions

Fix changelog merging across MC versions #3

Workflow file for this run

# Based off https://github.com/MinecraftForge/SharedActions/blob/main/.github/workflows/gradle.yml
name: Gradle Publishing CI
on:
workflow_call:
inputs:
java:
description: "The version of Java to use to run Gradle"
required: false
type: string
default: "21"
gradle_tasks:
description: "The Gradle task(s) to run at publication"
required: false
type: string
default: "publish"
curse_release_type:
description: "The type of release to publish to CurseForge"
required: false
type: string
default: "beta"
changelog_max_issues:
description: "The maximum number of issues to include in the changelog"
required: false
type: number
default: 100
secrets:
DISCORD_WEBHOOK:
required: true
MAVEN_USER:
required: true
MAVEN_PASSWORD:
required: true
CURSE_API_KEY:
required: true
CROWDIN_API_KEY:
required: true
GRADLE_ENCRYPTION_KEY:
description: The AES key to enable Gradle cache encryption
required: true
GITHUB_TOKEN:

Check failure on line 41 in .github/workflows/gradle.publish.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/gradle.publish.yaml

Invalid workflow file

secret name `GITHUB_TOKEN` within `workflow_call` can not be used since it would collide with system reserved name
required: true
permissions:
contents: write
statuses: write
jobs:
generate-release-information:
name: "Generate release information"
runs-on: ubuntu-latest
outputs:
release_version_suffix: ${{ steps.generateReleaseSuffix.outputs.release_version_suffix }}
steps:
- id: generateReleaseSuffix
name: "Generate release suffix"
run: |
release_version_suffix="alpha"
if [[ ${{ inputs.curse_release_type }} == release ]]; then
release_version_suffix=""
elif [[ ${{ inputs.curse_release_type }} == beta ]]; then
release_version_suffix="snapshot"
fi
echo "Release version suffix: ${release_version_suffix}"
echo "release_version_suffix=${release_version_suffix}" >> "$GITHUB_OUTPUT"
compute-version:
needs: [ "generate-release-information" ]
uses: ./.github/workflows/gradle.version.yaml
with:
suffix: ${{ needs.generate-release-information.outputs.release_version_suffix }}
notify-build-start:
needs: [ "compute-version" ]
name: "πŸ”΄ Build notifications (start)"
runs-on: ubuntu-latest
steps:
- uses: neoforged/action-webhooks@v1
name: "πŸ”΄ Send Discord start notification"
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
status: 'started'
version: "${{ needs.compute-version.outputs.full_version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: neoforged/action-github-status@v1
name: "🚧 Set pending status"
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'Publishing'
state: 'pending'
description: ${{ needs.compute-version.outputs.release_text }}
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
gradle:
needs: [ "compute-version" ]
runs-on: ubuntu-latest
steps:
- id: checkout
name: "πŸ“¦ Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 1000
fetch-tags: true
- id: setupJava
name: "πŸ”§ Setup Java"
run: |
echo "JAVA_HOME=$(echo $JAVA_HOME_${{ inputs.java }}_X64)" >> "$GITHUB_ENV"
- id: setupGradle
name: "πŸ”§ Setup Gradle"
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: wrapper
dependency-graph: generate-and-submit
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- id: tagLocalBuild
name: "🏷️ Tag local build"
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git tag -a "${{ needs.compute-version.outputs.tag_version }}" -m "${{ needs.compute-version.outputs.release_text }}"
- id: generateReleaseChangelog
name: "πŸ“ Generate release changelog"
uses: heinrichreimer/[email protected]
with:
output: changelog.md
token: ${{ secrets.GITHUB_TOKEN }}
stripGeneratorNotice: "true"
onlyLastTag: true
excludeTagsRegex: ${{ needs.compute-version.outputs.tag_regex }}
maxIssues: ${{ inputs.changelog_max_issues }}
- id: publish
name: "πŸš€ Publish"
run: ./gradlew --build-cache ${{ inputs.gradle_tasks }} -PmodVersion=${{ needs.compute-version.outputs.mod_version }} -PmodVersionSuffix=${{ needs.compute-version.outputs.suffix }}
env:
LDTTeamJfrogUsername: ${{ secrets.MAVEN_USER }}
LDTTeamJfrogPassword: ${{ secrets.MAVEN_PASSWORD }}
CURSE_API_KEY: ${{ secrets.CURSE_API_KEY }}
CURSE_RELEASE_TYPE: ${{ inputs.curse_release_type }}
crowdinKey: ${{ secrets.CROWDIN_API_KEY }}
- name: "πŸš€ Create GitHub release"
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.compute-version.outputs.tag_version }}
release_name: ${{ needs.compute-version.outputs.release_text }}
body_path: changelog.md
prerelease: ${{ inputs.curse_release_type != 'release' }}
notify-build-end:
needs: [ "compute-version", "notify-build-start", "gradle" ]
name: "πŸ”΄ Build notifications (end)"
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- uses: neoforged/action-webhooks@v1
name: "πŸ”΄ Send Discord end notification"
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ needs.gradle.result }}
version: "${{ needs.compute-version.outputs.full_version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: neoforged/action-github-status@v1
name: "🚧 Set build status"
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
context: 'Publishing'
state: ${{ needs.gradle.result }}
description: ${{ needs.compute-version.outputs.release_text }}
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}