Skip to content

Commit

Permalink
Restructure release workflows
Browse files Browse the repository at this point in the history
Generate release tried-and-tested way. Upload Forge and Fabric independantly to Modrinth and CurseForge
  • Loading branch information
Griefed committed Nov 11, 2023
1 parent a98a99e commit c4cff23
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 27 deletions.
59 changes: 45 additions & 14 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish on GitHub, CurseForge & Modrinth
name: Publish prerelease on GitHub, CurseForge & Modrinth

on:
push:
Expand All @@ -10,9 +10,8 @@ on:
env:
MINECRAFT_VERSION: 1.19.2
JAVA_VERSION: 17
MODRINTH_TOKEN: ${{ secrets.PUBLISH_MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.PUBLISH_CURSEFORGE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PUBLISH_GITHUB_TOKEN }}
GITLAB_URL: https://git.griefed.de
GITLAB_PROJECT_ID: 119

permissions:
contents: write
Expand All @@ -36,10 +35,46 @@ jobs:
- name: Use tag
run: echo ${{steps.tag.outputs.tag}}


# GET RELEASE INFO
- name: Get Release Info
run: |
curl --header \
'PRIVATE-TOKEN: ${{ secrets.GITLAB_TOKEN }}' \
'${{ env.GITLAB_URL }}/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/releases/${{ needs.preparations.outputs.version }}' >> version.json
# GET DESCRIPTION
- name: Extract version changelog
uses: sergeysova/[email protected]
id: description
with:
cmd: "jq .description version.json -r | sed -e 's/\\n/\\n/g' > description.txt"
multiline: true

- name: Dafuq # Otherwise we wouldn't be able to work with the file. Because reasons...
run: sudo chown $USER description.txt

- name: Create Release
id: create_release
uses: softprops/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ needs.preparations.outputs.version }}
name: Pre-Release ${{ needs.preparations.outputs.version }}
body_path: description.txt
draft: false
prerelease: true

build:
needs: preparations
strategy:
matrix:
include:
- platform: forge
name: Forge
- platform: fabric
name: Fabric
runs-on: ubuntu-latest

steps:
- name: Check Environment Variables
run: env
Expand All @@ -56,35 +91,31 @@ jobs:
java-version: 17

- name: Make Gradle Wrapper Executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew

- name: Build
run: ./gradlew -Pversion="${{ needs.preparations.outputs.version }}" clean blockAndItemCodeGen build

- name: Publish (CurseForge/Modrinth/GitHub)
uses: Kir-Antipov/mc-publish@v3.2
uses: Kir-Antipov/mc-publish@v3.3
with:
loaders: |
fabric
forge
${{ matrix.platform }}
curseforge-id: 935081
curseforge-token: "${{ secrets.CURSEFORGE_TOKEN }}"

modrinth-id: usDxEvVr
modrinth-token: "${{ secrets.MODRINTH_TOKEN }}"
modrinth-unfeature-mode: loader-any

github-tag: "${{ needs.preparations.outputs.version }}"
github-token: "${{ secrets.GITHUB_TOKEN }}"
github-prerelease: true

name: "AddEmAll ${{ needs.preparations.outputs.version }} for Minecraft 1.19.2"
version: "${{ needs.preparations.outputs.version }}"
changelog-file: CHANGELOG.md
name: "AddEmAll ${{ matrix.name }} ${{ needs.preparations.outputs.version }} for Minecraft 1.19.2"

game-versions: "${{ env.MINECRAFT_VERSION }}"
java: "${{ env.JAVA_VERSION }}"

files: |
+(Forge|Fabric)/build/libs/*[0-9].jar
${{ matrix.name }}/build/libs/*[0-9].jar
57 changes: 44 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish on GitHub, CurseForge & Modrinth
name: Publish release on GitHub, CurseForge & Modrinth

on:
push:
Expand All @@ -8,9 +8,8 @@ on:
env:
MINECRAFT_VERSION: 1.19.2
JAVA_VERSION: 17
MODRINTH_TOKEN: ${{ secrets.PUBLISH_MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.PUBLISH_CURSEFORGE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PUBLISH_GITHUB_TOKEN }}
GITLAB_URL: https://git.griefed.de
GITLAB_PROJECT_ID: 119

permissions:
contents: write
Expand All @@ -34,10 +33,45 @@ jobs:
- name: Use tag
run: echo ${{steps.tag.outputs.tag}}


# GET RELEASE INFO
- name: Get Release Info
run: |
curl --header \
'PRIVATE-TOKEN: ${{ secrets.GITLAB_TOKEN }}' \
'${{ env.GITLAB_URL }}/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/releases/${{ needs.preparations.outputs.version }}' >> version.json
# GET DESCRIPTION
- name: Extract version changelog
uses: sergeysova/[email protected]
id: description
with:
cmd: "jq .description version.json -r | sed -e 's/\\n/\\n/g' > description.txt"
multiline: true

- name: Dafuq # Otherwise we wouldn't be able to work with the file. Because reasons...
run: sudo chown $USER description.txt

- name: Create Release
id: create_release
uses: softprops/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ needs.preparations.outputs.version }}
name: Pre-Release ${{ needs.preparations.outputs.version }}
body_path: description.txt
draft: false

build:
needs: preparations
strategy:
matrix:
include:
- platform: forge
name: Forge
- platform: fabric
name: Fabric
runs-on: ubuntu-latest

steps:
- name: Check Environment Variables
run: env
Expand All @@ -54,34 +88,31 @@ jobs:
java-version: 17

- name: Make Gradle Wrapper Executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew

- name: Build
run: ./gradlew -Pversion="${{ needs.preparations.outputs.version }}" clean blockAndItemCodeGen build

- name: Publish (CurseForge/Modrinth/GitHub)
uses: Kir-Antipov/mc-publish@v3.2
uses: Kir-Antipov/mc-publish@v3.3
with:
loaders: |
fabric
forge
${{ matrix.platform }}
curseforge-id: 935081
curseforge-token: "${{ secrets.CURSEFORGE_TOKEN }}"

modrinth-id: usDxEvVr
modrinth-token: "${{ secrets.MODRINTH_TOKEN }}"
modrinth-unfeature-mode: loader-any

github-tag: "${{ needs.preparations.outputs.version }}"
github-token: "${{ secrets.GITHUB_TOKEN }}"

name: "AddEmAll ${{ needs.preparations.outputs.version }} for Minecraft 1.19.2"
version: "${{ needs.preparations.outputs.version }}"
changelog-file: CHANGELOG.md
name: "AddEmAll ${{ matrix.name }} ${{ needs.preparations.outputs.version }} for Minecraft 1.19.2"

game-versions: "${{ env.MINECRAFT_VERSION }}"
java: "${{ env.JAVA_VERSION }}"

files: |
+(Forge|Fabric)/build/libs/*[0-9].jar
${{ matrix.name }}/build/libs/*[0-9].jar

0 comments on commit c4cff23

Please sign in to comment.