Skip to content
# Publishes the project to GitHub Releases, CurseForge, and Modrinth
name: Publish Project
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # any SemVer tag, e.g. v1.2.3
env:
# link to the changelog with a format code for the version
CHANGELOG_LOCATION: "Changelog is available [here](https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }})"
# type of release
RELEASE_TYPE: "beta"
concurrency:
group: publish-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: write # needed to create GitHub releases
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build Project
run: ./gradlew build --warning-mode all --build-cache
- name: Publish to GitHub
uses: softprops/action-gh-release@v2
with:
files: |
"forge/build/libs/betterp2p-${{ steps.build.outputs.version }}-forge.jar"
"fabric/build/libs/betterp2p-${{ steps.build.outputs.version }}-fabric.jar"
generate_release_notes: true
fail_on_unmatched_files: true
- name: "Upload Forge to CurseForge"
uses: itsmeow/curseforge-upload@v3
with:
file_path: "forge/build/libs/betterp2p-${{ steps.build.outputs.version }}-forge.jar"
game_endpoint: "minecraft"
relations: "applied-energistics-2:requiredDependency,architectury-api:requiredDependency,kotlin-for-forge:requiredDependency"
game_versions: "Minecraft 1.20.1,Java 17,Forge"
project_id: "538092"
token: "${{ secrets.CF_API_TOKEN }}"
- name: "Upload Fabric to CurseForge"
uses: itsmeow/curseforge-upload@v3
with:
file_path: "fabric/build/libs/betterp2p-${{ steps.build.outputs.version }}-fabric.jar"
game_endpoint: "minecraft"
relations: "fabric-api:requiredDependency,applied-energistics-2:requiredDependency,fabric-language-kotlin:requiredDependency,architectury-api:requiredDependency"
game_versions: "Minecraft 1.20.1,Java 17,Fabric"
project_id: "538092"
token: "${{ secrets.CF_API_TOKEN }}"
- name: "Upload Forge to Modrinth"
uses: dsx137/modrinth-release-action@main
env:
MODRINTH_TOKEN: "${{ secrets.MODRINTH_TOKEN }}"
with:
name: "[Forge 1.20.1] v${{ steps.build.outputs.version }}"
project_id: 9DDxOvTJ
loaders: forge
game_versions: 1.20.1
version_number: "${{ steps.build.outputs.version }}"
files: |
"forge/build/libs/betterp2p-${{ steps.build.outputs.version }}-forge.jar"
dependencies: lhGA9TYQ:required, ordsPcFz:required, XxWD5pD3:required
version_type: release
- name: "Upload Fabric to Modrinth"
uses: dsx137/modrinth-release-action@main
env:
MODRINTH_TOKEN: "${{ secrets.MODRINTH_TOKEN }}"
with:
name: "[Fabric 1.20.1] v${{ steps.build.outputs.version }}"
project_id: 9DDxOvTJ
loaders: fabric
game_versions: 1.20.1
version_number: "${{ steps.build.outputs.version }}"
files: |
"fabric/build/libs/betterp2p-${{ steps.build.outputs.version }}-fabric.jar"
dependencies: P7dR8mSH:required, XxWD5pD3:required, Ha28R6CL:required, lhGA9TYQ: required

Check failure on line 104 in .github/workflows/publish_project.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish_project.yml

Invalid workflow file

You have an error in your yaml syntax on line 104
version_type: release