Skip to content

fix

fix #902

Workflow file for this run

name: CI
on:
push:
branches: [ "**" ]
pull_request:
types:
- opened
- synchronize
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up JDK 21
uses: actions/[email protected]
with:
java-version: 21
distribution: 'adopt'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/actions/[email protected]
- name: Build with Gradle
run: ./gradlew build --warning-mode all
paths-filter:
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.filter.outputs.java }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
java:
- 'src/**'
- 'build.gradle.kts'
createJar:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up JDK 21
uses: actions/[email protected]
with:
java-version: 21
distribution: 'adopt'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/actions/[email protected]
- name: Set version env variable
run: |
echo "runnumber=${{ github.run_number }}" >> $GITHUB_ENV
- run: ./gradlew jar
- name: Upload artifact
uses: actions/[email protected]
with:
name: StationofdoomPlugin
path: build/libs
publishToRegistry:
runs-on: ubuntu-latest
needs: [build, paths-filter]
if: ${{ github.ref == 'refs/heads/master' && needs.paths-filter.outputs.output1 == 'true' }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up JDK 21
uses: actions/[email protected]
with:
java-version: 21
distribution: 'adopt'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/actions/[email protected]
- name: Set env variables
run: |
echo "REPOSILITE_USER=${{ secrets.REPOSILITE_USER }}" >> $GITHUB_ENV
echo "REPOSILITE_PW=${{ secrets.REPOSILITE_PW }}" >> $GITHUB_ENV
- name: Publish
run: |
./gradlew publish -PtargetRepo=snapshots
env:
MAVEN_USERNAME: ${{ secrets.REPOSILITE_USER }}
MAVEN_PASSWORD: ${{ secrets.REPOSILITE_PW }}
releaseJar:
runs-on: ubuntu-latest
needs: [createJar, paths-filter]
if: ${{ github.ref == 'refs/heads/master' && needs.paths-filter.outputs.output1 == 'true' }}
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: StationofdoomPlugin
path: build/libs
- name: Check folder
run: ls build/libs
- name: Get file name
id: get_filename
run: |
FILE_PATH=$(find build/libs -name "*.jar" | head -n 1)
FILE_NAME=$(basename "$FILE_PATH")
version=$(echo "$FILE_NAME" | grep -o '[0-9.]\+')
version="${version%.}"
echo "$version"
echo "FILENAME=$version" >> $GITHUB_ENV
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: "build/libs/*.jar"
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
tag: "v${{ env.FILENAME }}"
publishToModrinth:
runs-on: ubuntu-latest
needs: [createJar, releaseJar]
if: ${{ github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up JDK 21
uses: actions/[email protected]
with:
java-version: 21
distribution: 'adopt'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/actions/[email protected]
- name: Set env variables
run: |
echo "runnumber=${{ github.run_number }}" >> $GITHUB_ENV
echo "MODRINTH_TOKEN=${{ secrets.MODRINTH_TOKEN }}" >> $GITHUB_ENV
- run: ./gradlew modrinth