Multiverse-Core/.github/workflows/modrinth_upload.yml
2023-08-22 11:27:30 +08:00

54 lines
1.7 KiB
YAML

name: Manually upload specific release to modrinth.com
on:
workflow_dispatch:
inputs:
version:
description: 'Release to upload'
required: true
jobs:
manually_upload_modrinth_release:
runs-on: ubuntu-latest
steps:
- name: Get release info
id: release-info
uses: cardinalby/git-get-release-action@1.2.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ github.event.inputs.version }}
- name: Modify version scheme
run: |
if [[ "${{ steps.release-info.outputs.tag_name }}" == *"pre"* ]]; then
echo "Replacing prerelease version scheme with SNAPSHOT"
echo "VERSION=$(echo ${{ steps.release-info.outputs.tag_name }} | sed -E 's/-pre.*/-SNAPSHOT/')" >> $GITHUB_ENV
else
echo "Using release version scheme"
echo "VERSION=${{ steps.release-info.outputs.tag_name }}" >> $GITHUB_ENV
fi
- name: Parse release type
run: |
if [[ "${{ steps.release-info.outputs.prerelease }}" == "true" ]]; then
echo "RELEASE_TYPE=beta" >> $GITHUB_ENV
else
echo "RELEASE_TYPE=release" >> $GITHUB_ENV
fi
- uses: actions/checkout@v3
with:
ref: ${{ steps.release-info.outputs.tag_name }}
- name: Upload to modrinth.com
uses: gradle/gradle-build-action@v2
with:
arguments: build modrinth
env:
GITHUB_VERSION: ${{ env.VERSION }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CHANGELOG: ${{ steps.release-info.outputs.body }}
VERSION_NUMBER: ${{ steps.release-info.outputs.tag_name }}
VERSION_TYPE: ${{ env.RELEASE_TYPE }}