Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: publish to modrinth
Browse files Browse the repository at this point in the history
MrTJP committed Dec 24, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 6666c50 commit b51f670
Showing 3 changed files with 101 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
fire==0.4.0
curseuploadpy @ git+https://github.com/MrTJP/curseuploadpy.git@dev
modrinthpy @ git+https://github.com/MrTJP/modrinthpy.git@dev
67 changes: 56 additions & 11 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -32,26 +32,26 @@ jobs:
case $release_type in
"release")
publish_maven=true
publish_curse=true
publish_launchers=true
publish_gh_release=true
version_format="{major}.{minor}.{patch}"
;;
"beta")
publish_maven=true
publish_curse=true
publish_launchers=true
publish_gh_release=false
version_format="{major}.{minor}.{patch}-beta+{increment}"
;;
"alpha")
publish_maven=true
publish_curse=false
publish_launchers=false
publish_gh_release=false
version_format="{major}.{minor}.{patch}-alpha+{increment}"
;;
*)
echo "::warning::Unknown release type: $release_type"
publish_maven=false
publish_curse=false
publish_launchers=false
publish_gh_release=false
version_format="{major}.{minor}.{patch}-$release_type+{increment}"
esac
@@ -61,7 +61,7 @@ jobs:
echo "release_channel=$release_channel" >> $GITHUB_OUTPUT
echo "release_type=$release_type" >> $GITHUB_OUTPUT
echo "publish_maven=$publish_maven" >> $GITHUB_OUTPUT
echo "publish_curse=$publish_curse" >> $GITHUB_OUTPUT
echo "publish_launchers=$publish_launchers" >> $GITHUB_OUTPUT
echo "publish_gh_release=$publish_gh_release" >> $GITHUB_OUTPUT
echo "version_format=$version_format" >> $GITHUB_OUTPUT
echo "tag_format=$tag_format" >> $GITHUB_OUTPUT
@@ -127,16 +127,17 @@ jobs:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}

- name: Curse publish
if: ${{ steps.release_type.outputs.publish_curse == 'true' }}
- name: Publish to Curse
if: ${{ steps.release_type.outputs.publish_launchers == 'true' }}
run: |
# Base args for all modules
COMMON_ARGS=( \
-k $CURSE_TOKEN \
-rt $CURSE_RELEASE_TYPE \
-k $API_TOKEN \
-rt $RELEASE_TYPE \
-v 'Java 17' \
-v 1.20.1 \
-v Forge \
-v NeoForge \
-c ./CHANGELOG.md \
--required-dep codechicken-lib-1-8 \
--required-dep cb-multipart \
@@ -164,8 +165,52 @@ jobs:
python -m curseuploadpy "${MODULE_ARGS[@]}" -p 478939 -f transmission/build/libs/*-transmission.jar
env:
CURSE_RELEASE_TYPE: ${{ steps.release_type.outputs.release_type }}
CURSE_TOKEN: ${{ secrets.CURSE_TOKEN }}
RELEASE_TYPE: ${{ steps.release_type.outputs.release_type }}
API_TOKEN: ${{ secrets.CURSE_TOKEN }}


- name: Publish to Modrinth
if: ${{ steps.release_type.outputs.publish_launchers == 'true' }}
run: |
# Base args for all modules
COMMON_ARGS=( \
-k $API_TOKEN \
create-version \
-v "$AUTO_GENERATED_VERSION" \
-c ./CHANGELOG.md \
-gv 1.20.1 \
-vt $RELEASE_TYPE \
-l Forge \
-l NeoForge \
--required-dep codechicken-lib-1-8 \
--required-dep cb-multipart \
)
# All submodules need PR Core
MODULE_ARGS=( \
"${COMMON_ARGS[@]}" \
--required-dep project-red-core \
)
# Fabrication is special and also needs Integration and Transmission
FAB_ARGS=( \
"${MODULE_ARGS[@]}" \
--required-dep project-red-integration \
--required-dep project-red-transmission \
)
python -m modrinthpy "${COMMON_ARGS[@]}" -p 228702 -f core/build/libs/*-core.jar
python -m modrinthpy "${MODULE_ARGS[@]}" -p 229048 -f expansion/build/libs/*-expansion.jar
python -m modrinthpy "${MODULE_ARGS[@]}" -p 229049 -f exploration/build/libs/*-exploration.jar
python -m modrinthpy "${FAB_ARGS[@]}" -p 230111 -f fabrication/build/libs/*-fabrication.jar
python -m modrinthpy "${MODULE_ARGS[@]}" -p 229046 -f illumination/build/libs/*-illumination.jar
python -m modrinthpy "${MODULE_ARGS[@]}" -p 229045 -f integration/build/libs/*-integration.jar
python -m modrinthpy "${MODULE_ARGS[@]}" -p 478939 -f transmission/build/libs/*-transmission.jar
env:
RELEASE_TYPE: ${{ steps.release_type.outputs.release_type }}
API_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
AUTO_GENERATED_VERSION: ${{ steps.versioning.outputs.version }}

- name: Tag and Release
if: ${{ steps.release_type.outputs.publish_gh_release == 'true' }}
44 changes: 44 additions & 0 deletions .github/workflows/verify-pull-request.yaml
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ jobs:
build_test:
name: Build and Test
runs-on: ubuntu-latest
environment: prod
steps:
- name: Checkout git repo
uses: actions/checkout@v3
@@ -91,3 +92,46 @@ jobs:
with:
name: project-red-${{ steps.versioning.outputs.version }}
path: '*/build/libs/ProjectRed-*.jar'

- name: TEST Publish to Modrinth
# if: ${{ steps.release_type.outputs.publish_launchers == 'true' }}
run: |
# Base args for all modules
COMMON_ARGS=( \
-k $API_TOKEN \
create-version \
-v "$AUTO_GENERATED_VERSION" \
-c ./CHANGELOG.md \
-gv 1.20.1 \
-vt $RELEASE_TYPE \
-l Forge \
-l NeoForge \
--required-dep codechicken-lib \
--required-dep cb-multipart \
)
# All submodules need PR Core
MODULE_ARGS=( \
"${COMMON_ARGS[@]}" \
--required-dep project-red-core \
)
# Fabrication is special and also needs Integration and Transmission
FAB_ARGS=( \
"${MODULE_ARGS[@]}" \
--required-dep project-red-integration \
--required-dep project-red-transmission \
)
python -m modrinthpy "${COMMON_ARGS[@]}" -p project-red-core -f core/build/libs/*-core.jar
python -m modrinthpy "${MODULE_ARGS[@]}" -p project-red-expansion -f expansion/build/libs/*-expansion.jar
python -m modrinthpy "${MODULE_ARGS[@]}" -p project-red-exploration -f exploration/build/libs/*-exploration.jar
python -m modrinthpy "${FAB_ARGS[@]}" -p project-red-fabrication -f fabrication/build/libs/*-fabrication.jar
python -m modrinthpy "${MODULE_ARGS[@]}" -p project-red-illumination -f illumination/build/libs/*-illumination.jar
python -m modrinthpy "${MODULE_ARGS[@]}" -p project-red-integration -f integration/build/libs/*-integration.jar
python -m modrinthpy "${MODULE_ARGS[@]}" -p project-red-transmission -f transmission/build/libs/*-transmission.jar
env:
RELEASE_TYPE: alpha
API_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
AUTO_GENERATED_VERSION: ${{ steps.versioning.outputs.version }}

0 comments on commit b51f670

Please sign in to comment.