Skip to content

bump version

bump version #35

Workflow file for this run

name: Publish
on:
push:
tags:
- v*
workflow_dispatch:
inputs:
versionType:
description: 'Version Type'
required: true
default: 'alpha'
type: choice
options:
- alpha
- beta
- release
additionalVersionInfo:
description: 'Additional Version Info. Only relevant for beta versions.'
required: false
default: ''
type: string
permissions:
contents: read
jobs:
determine-environment:
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.get_environment.outputs.environment }}
version: ${{ steps.get_environment.outputs.version }}
tag: ${{ steps.get_environment.outputs.tag }}
steps:
- uses: actions/checkout@v3
- name: Determine Environment
id: get_environment
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
if [[ "${{ github.event.inputs.versionType }}" == 'alpha' ]]; then
echo "environment=Testing" >> $GITHUB_OUTPUT
echo "version=alpha" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.inputs.versionType }}" == 'beta' ]]; then
echo "environment=Testing" >> $GITHUB_OUTPUT
echo "version=beta=${{ github.event.inputs.additionalVersionInfo }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.inputs.versionType }}" == 'release' ]]; then
echo "environment=Release" >> $GITHUB_OUTPUT
echo "version=release" >> $GITHUB_OUTPUT
fi
echo "tag=false" >> $GITHUB_OUTPUT
elif [[ ${{ github.event.ref }} =~ refs\/tags\/v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)-(0|[1-9]\d*)\.(0|[1-9]\d*) ]]; then
echo "environment=Release" >> $GITHUB_OUTPUT
echo "version=release" >> $GITHUB_OUTPUT
echo "tag=true" >> $GITHUB_OUTPUT
fi
determine-crowdin-branch:
runs-on: ubuntu-latest
needs: determine-environment
environment: ${{ needs.determine-environment.outputs.environment }}
outputs:
crowdin_branch: ${{ steps.get_crowdin_branch.outputs.crowdin_branch }}
steps:
- uses: actions/checkout@v3
- name: Determine Crowdin branch
id: get_crowdin_branch
run: |
if [[ ${{ needs.determine-environment.outputs.tag }} == 'true' ]]; then
echo "crowdin_branch=$(echo ${{ github.ref_name }} | awk -F"-" '{print $2}' | cut -d '.' -f 1,2)" >> $GITHUB_OUTPUT
else
echo "crowdin_branch=$(echo ${{ github.ref_name }} | cut -d '.' -f 1,2)" >> $GITHUB_OUTPUT
fi
publish:
runs-on: ubuntu-latest
needs: [determine-crowdin-branch, determine-environment]
environment: ${{ needs.determine-environment.outputs.environment }}
if: needs.determine-environment.outputs.version != '' && needs.determine-environment.outputs.environment != ''
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: 'gradle'
- name: Install Crowdin CLI
run: npm i -g @crowdin/cli
- name: Download translations
run: crowdin download -b ${{ needs.determine-crowdin-branch.outputs.crowdin_branch }}
env:
CROWDIN_KEY: ${{ secrets.CROWDIN_KEY }}
- name: Publish
uses: gradle/gradle-build-action@v2.7.0
with:
arguments: build publish curseforge modrinth -PMAVEN_URL=${{ secrets.MAVEN_URL }} -PMAVEN_USER=${{ secrets.MAVEN_USER }} -PMAVEN_TOKEN=${{ secrets.MAVEN_TOKEN }} -PCURSEFORGE_API=${{ secrets.CURSEFORGE_API }} -PMODRINTH_API=${{ secrets.MODRINTH_API }} -P${{ needs.determine-environment.outputs.version }}