fix: Avoid constantly requerying on failure to spawn a fishing spot, … #98
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish-snapshot | |
on: | |
push: | |
branches: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
- '[0-9]+.[0-9]+' | |
jobs: | |
prepare-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.result }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Preparing matrix | |
id: set-matrix | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const fs = require('fs'); | |
const settingsGradle = fs.readFileSync('settings.gradle', 'utf8'); | |
const includePattern = /^(?!\s*\/\/)\s*include\s*\(\s*(['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])*\s*)\)/gm; | |
const includes = [...settingsGradle.matchAll(includePattern)] | |
.flatMap(match => match[0].match(/['"]([^'"]+)['"]/g).map(item => item.replace(/['"]/g, ''))); | |
const includeFabric = includes.includes('fabric'); | |
const includeForge = includes.includes('forge'); | |
const includeNeoForge = includes.includes('neoforge'); | |
const gradleProperties = fs.readFileSync('gradle.properties', 'utf8'); | |
const mavenSnapshots = gradleProperties.match(/^(?!#)maven_snapshots\s*=\s*(.+)/m); | |
return { | |
loader: ['common', includeFabric ? 'fabric' : false, includeForge ? 'forge' : false, includeNeoForge ? 'neoforge' : false].filter(Boolean), | |
task: [mavenSnapshots ? 'publish' : 'build'] | |
}; | |
publish-snapshot: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: ${{fromJson(needs.prepare-matrix.outputs.matrix)}} | |
fail-fast: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- 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: Extracting version from properties | |
shell: bash | |
run: echo "version=$(cat gradle.properties | grep -w "\bversion\s*=" | 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: Publish | |
run: ./gradlew :${{ matrix.loader }}:${{ matrix.task }} '-Pversion=${{ steps.bump-version.outputs.version }}-SNAPSHOT' '-PmavenUsername=${{ secrets.MAVEN_USER }}' '-PmavenPassword=${{ secrets.MAVEN_PASSWORD }}' | |
needs: prepare-matrix |