Skip to content

publish-release

publish-release #44

Workflow file for this run

name: publish-release
on:
workflow_dispatch:
inputs:
forge:
description: 'Forge'
required: true
type: boolean
default: true
fabric:
description: 'Fabric'
required: true
type: boolean
default: true
neoforge:
description: 'NeoForge'
required: true
type: boolean
default: true
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
ref: v${{ steps.bump-version.outputs.version }}
version: ${{ steps.bump-version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extracting version from properties
shell: bash
run: echo "version=$(cat gradle.properties | grep -w "\bversion" | cut -d= -f2)" >> $GITHUB_OUTPUT
id: extract-version
- name: Bumping version
uses: TwelveIterationMods/bump-version@v1
with:
version: ${{ steps.extract-version.outputs.version }}
bump: patch
id: bump-version
#- name: Updating version properties
# run: |
# sed -i "s/^\s*version\s*=.*/version = ${{ steps.bump-version.outputs.version }}/g" gradle.properties
# git config user.name "GitHub Actions"
# git config user.email "<>"
# git commit -am "Set version to ${{ steps.bump-version.outputs.version }}"
# git push origin ${BRANCH_NAME}
# git tag -a "v${{ steps.bump-version.outputs.version }}" -m "Release ${{ steps.bump-version.outputs.version }}"
# git push origin "v${{ steps.bump-version.outputs.version }}"
# shell: bash
# env:
# BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
build-release:
runs-on: ubuntu-latest
strategy:
matrix:
loader: ${{ toJson([

Check failure on line 56 in .github/workflows/publish-release.yml

View workflow run for this annotation

GitHub Actions / publish-release

Invalid workflow file

The workflow is not valid. .github/workflows/publish-release.yml (Line: 56, Col: 17): Unexpected symbol: '['. Located at position 8 within expression: toJson([ 'common', inputs.fabric && 'fabric' || null, inputs.forge && 'forge' || null, inputs.neoforge && 'neoforge' || null ] | compact) .github/workflows/publish-release.yml (Line: 56, Col: 17): Unexpected value '${{ toJson([ 'common', inputs.fabric && 'fabric' || null, inputs.forge && 'forge' || null, inputs.neoforge && 'neoforge' || null ] | compact) }}'
'common',
inputs.fabric && 'fabric' || null,
inputs.forge && 'forge' || null,
inputs.neoforge && 'neoforge' || null
] | compact) }}
site: [ curseforge, modrinth, publish ]
exclude:
- loader: common
site: curseforge
- loader: common
site: modrinth
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build ${{ matrix.loader }} artifact
run: ./gradlew :${{ matrix.loader }}:build
- name: Upload ${{ matrix.loader }} artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.loader }}-artifact
path: ${{ matrix.loader }}/build/libs/*
needs: create-release
publish-release:
runs-on: ubuntu-latest
strategy:
matrix:
loader: ${{ toJson([
'common',
inputs.fabric && 'fabric' || null,
inputs.forge && 'forge' || null,
inputs.neoforge && 'neoforge' || null
] | compact) }}
site: [ curseforge, modrinth, publish ]
exclude:
- loader: common
site: curseforge
- loader: common
site: modrinth
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ needs.create-release.outputs.ref }}
- name: Download ${{ matrix.loader }} artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.loader }}-artifact
- name: Validate gradle wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
- name: Make gradle wrapper executable
run: chmod +x ./gradlew
- name: Check current artifact hash TODO
run: sha1sum ${{ matrix.loader }}/build/libs/*
- name: Publish
#run: ./gradlew :${{ matrix.loader }}:${{ matrix.site }} '-Pversion=${{needs.create-release.outputs.version}}' '-PtwelveIterationsNexusUsername=${{ secrets.NEXUS_USER }}' '-PtwelveIterationsNexusPassword=${{ secrets.NEXUS_PASSWORD }}'
run: ./gradlew :${{ matrix.loader }}:build '-Pversion=${{needs.create-release.outputs.version}}' '-PtwelveIterationsNexusUsername=${{ secrets.NEXUS_USER }}' '-PtwelveIterationsNexusPassword=${{ secrets.NEXUS_PASSWORD }}'
#env:
# CURSEFORGE_TOKEN: ${{secrets.CURSEFORGE_TOKEN}}
# MODRINTH_TOKEN: ${{secrets.MODRINTH_TOKEN}}
- name: Check new artifact hash TODO
run: sha1sum ${{ matrix.loader }}/build/libs/*
needs: build-release