Skip to content

Commit

Permalink
gaming???
Browse files Browse the repository at this point in the history
  • Loading branch information
Vazkii committed Oct 9, 2023
1 parent 9f4e2d7 commit 5aead1b
Showing 1 changed file with 51 additions and 51 deletions.
102 changes: 51 additions & 51 deletions scripts/upload_releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,54 @@ TAGNAME="${GIT_REF/#refs\/tags\/}"
VERSION="${TAGNAME/#release-}"
MC_VERSION=$(echo "${VERSION}" | cut -d '-' -f 1)

#function release_github() {
# echo >&2 'Creating GitHub Release'
# local GH_RELEASE_RESPONSE
# GH_RELEASE_RESPONSE="$(gh api \
# --method POST \
# -H "Accept: application/vnd.github+json" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# /repos/VazkiiMods/Quark/releases \
# -f tag_name="${TAGNAME}")"
# GH_RELEASE_PAGE=$(echo "$GH_RELEASE_RESPONSE" | jq -r .html_url)
#
# echo >&2 'Uploading Forge Jar and Signature to GitHub'
# gh release upload "${TAGNAME}" "${FORGE_JAR}#Forge Jar"
# gh release upload "${TAGNAME}" "${FORGE_JAR}.asc#Forge Signature"
#}
#
#function release_modrinth() {
# echo >&2 'Uploading Forge Jar to Modrinth'
# local MODRINTH_FORGE_SPEC
# MODRINTH_FORGE_SPEC=$(cat <<EOF
#{
# "dependencies": [
# {
# "project_id": "NvZ9ZhwE",
# "dependency_type": "required"
# }],
# "version_type": "release",
# "loaders": ["forge"],
# "featured": false,
# "project_id": "qnQsVE2z",
# "file_parts": [
# "jar"
# ],
# "primary_file": "jar"
#}
#EOF
# )
#
# MODRINTH_FORGE_SPEC=$(echo "${MODRINTH_FORGE_SPEC}" | \
# jq --arg name "${VERSION}" \
# --arg mcver "${MC_VERSION}" \
# --arg changelog "${GH_RELEASE_PAGE}" \
# '.name=$ARGS.named.name | .version_number=$ARGS.named.name | .game_versions=[$ARGS.named.mcver] | .changelog=$ARGS.named.changelog')
# curl 'https://api.modrinth.com/v2/version' \
# -H "Authorization: $MODRINTH_TOKEN" \
# -F "data=$MODRINTH_FORGE_SPEC" \
# -F "jar=@${FORGE_JAR}" # TODO modrinth doesn't allow asc files. Remember to readd "signature" to the spec when reenabling this. \ -F "signature=@${FORGE_JAR}.asc"
#}
function release_github() {
echo >&2 'Creating GitHub Release'
local GH_RELEASE_RESPONSE
GH_RELEASE_RESPONSE="$(gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/VazkiiMods/Quark/releases \
-f tag_name="${TAGNAME}")"
GH_RELEASE_PAGE=$(echo "$GH_RELEASE_RESPONSE" | jq -r .html_url)

echo >&2 'Uploading Forge Jar and Signature to GitHub'
gh release upload "${TAGNAME}" "${FORGE_JAR}#Forge Jar"
gh release upload "${TAGNAME}" "${FORGE_JAR}.asc#Forge Signature"
}

function release_modrinth() {
echo >&2 'Uploading Forge Jar to Modrinth'
local MODRINTH_FORGE_SPEC
MODRINTH_FORGE_SPEC=$(cat <<EOF
{
"dependencies": [
{
"project_id": "NvZ9ZhwE",
"dependency_type": "required"
}],
"version_type": "release",
"loaders": ["forge"],
"featured": false,
"project_id": "qnQsVE2z",
"file_parts": [
"jar"
],
"primary_file": "jar"
}
EOF
)

MODRINTH_FORGE_SPEC=$(echo "${MODRINTH_FORGE_SPEC}" | \
jq --arg name "${VERSION}" \
--arg mcver "${MC_VERSION}" \
--arg changelog "${GH_RELEASE_PAGE}" \
'.name=$ARGS.named.name | .version_number=$ARGS.named.name | .game_versions=[$ARGS.named.mcver] | .changelog=$ARGS.named.changelog')
curl 'https://api.modrinth.com/v2/version' \
-H "Authorization: $MODRINTH_TOKEN" \
-F "data=$MODRINTH_FORGE_SPEC" \
-F "jar=@${FORGE_JAR}" # TODO modrinth doesn't allow asc files. Remember to readd "signature" to the spec when reenabling this. \ -F "signature=@${FORGE_JAR}.asc"
}

function release_curseforge() {
# Java versions, Loaders, and Environment tags are actually "game versions" (lmfao), as are real game versions.
Expand Down Expand Up @@ -95,7 +95,7 @@ $CURSEFORGE_FORGE_VERSION,\
$CURSEFORGE_GAME_VERSION]"

CURSEFORGE_FORGE_SPEC=$(echo "$CURSEFORGE_FORGE_SPEC" | \
jq --arg changelog "test" \
jq --arg changelog "$GH_RELEASE_PAGE" \
--argjson gamevers "$CURSEFORGE_FORGE_GAMEVERS" \
'.gameVersions=$ARGS.named.gamevers | .changelog=$ARGS.named.changelog')
curl 'https://minecraft.curseforge.com/api/projects/243121/upload-file' \
Expand All @@ -105,6 +105,6 @@ $CURSEFORGE_GAME_VERSION]"
# TODO: Upload the asc as an 'Additional file'
}

#release_github
#release_modrinth
release_github
release_modrinth
release_curseforge

0 comments on commit 5aead1b

Please sign in to comment.