Skip to content

[no-cl] add todo for AT removal #51

[no-cl] add todo for AT removal

[no-cl] add todo for AT removal #51

# This workflow will build a package using Gradle and then publish it to the usual places
name: Build & Publish
on:
push:
branches:
- 'release/**'
jobs:
build:
runs-on: ubuntu-latest
permissions:
#to create releases
contents: write
#for github maven? packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find last successful build (current branch)
id: last_success_build
uses: SamhammerAG/last-successful-build-action@v4
with:
workflow: ${{github.workflow}}
token: ${{github.token}}
#verify ensures that it's reachable on the current branch
verify: true
branch: ${{ github.ref_name }}
- name: Find last successful build (any branch)
id: last_success_build_any
uses: SamhammerAG/last-successful-build-action@v4
with:
workflow: ${{github.workflow}}
token: ${{github.token}}
#verify ensures that it's reachable on the current branch
verify: true
- uses: madhead/read-java-properties@latest
id: gradle_props
with:
file: gradle.properties
all: true
- name: Cache NG outputs
uses: actions/cache@v4
with:
key: ${{ steps.gradle_props.outputs.minecraft_version }}-${{ steps.gradle_props.outputs.forge_version }}
path: |
build/neoForge
build/neoForm
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: Build with Gradle
run: ./gradlew build outputChangelog
env:
BUILD_NUMBER: ${{ github.run_number }}
GIT_COMMIT: ${{ github.sha }}
GIT_PREVIOUS_SUCCESSFUL_COMMIT: ${{ steps.last_success_build.outputs.sha != github.sha && steps.last_success_build.outputs.sha || steps.last_success_build_any.outputs.sha }}
- name: Upload to workflow artifacts
uses: actions/upload-artifact@v4
with:
path: |
build/libs/
build/changelog.html
- name: GH Release
id: gh_release
uses: softprops/action-gh-release@v2
with:
files: build/libs/!(MekanismDefense*).jar
body_path: build/changelog.md
tag_name: v${{ steps.gradle_props.outputs.minecraft_version }}-${{ steps.gradle_props.outputs.mod_version }}.${{ github.run_number }}
target_commitish: ${{ github.sha }}
- name: Publish
run: ./gradlew curseforge modrinth publish
env:
CURSEFORGE_KEY: ${{ secrets.CURSEFORGE_KEY }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
MEK_MAVEN_PW: ${{ secrets.MEK_MAVEN_PW }}
BUILD_NUMBER: ${{ github.run_number }}
GIT_COMMIT: ${{ github.sha }}
GIT_PREVIOUS_SUCCESSFUL_COMMIT: ${{ steps.last_success_build.outputs.sha != github.sha && steps.last_success_build.outputs.sha || steps.last_success_build_any.outputs.sha }}
- name: Read changelog
id: read_changelog
uses: andstor/file-reader-action@v1
with:
path: "build/changelog.md"
- name: Announce Release
uses: tsickert/[email protected]
with:
webhook-url: ${{ secrets.WEBHOOK_URL }}
embed-title: Mekanism ${{ steps.gradle_props.outputs.mod_version }}.${{ github.run_number }} for Minecraft ${{ steps.gradle_props.outputs.minecraft_version }} Released
embed-url: ${{ steps.gh_release.outputs.url }}
embed-description: |
Available on Curseforge after approval.
${{ steps.read_changelog.outputs.contents }}