Skip to content

sqlite_jdbc_bumped

sqlite_jdbc_bumped #30

Workflow file for this run

name: Nightly Release
on:
push:
branches: [ main ]
repository_dispatch:
types: [ sqlite_jdbc_bumped ]
permissions:
contents: write # Needed for ncipollo/release-action to create releases and tags
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
# 1. Check out sources
- uses: actions/checkout@v3
with:
ref: 'main'
fetch-depth: 0 # Needed for changelogs based on git history
# 2. Extract Changelog
- name: Extract Changelog
id: changelog
run: |
NOTES=""
if [[ "${{ github.event_name }}" == "repository_dispatch" ]]; then
echo "Using changelog from dispatch payload."
NOTES="${{ github.event.client_payload.changelog }}"
else
echo "Using latest git commit message as changelog."
NOTES=$(git log -1 --pretty=%B)
fi
# This is the robust way to pass multiline strings
{
echo 'notes<<EOF'
echo "$NOTES"
echo 'EOF'
} >> "$GITHUB_OUTPUT"
# 3. Set up JDK21 + Gradle cache
- name: Set up JDK21
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '21'
cache: gradle
# 4. Validate and Build
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Build Shaded JAR
uses: gradle/gradle-build-action@v2
with:
arguments: 'clean build --no-daemon --stacktrace'
# 5. Find the JAR and extract its version
- name: Locate JAR & extract version
id: locate
run: |
set -e
jar_path=$(ls -1 build/libs/*-all.jar | head -n1)
if [ -z "$jar_path" ]; then echo "::error::Could not find the *-all.jar file" && exit 1; fi
ver=$(basename "$jar_path" | sed -E 's/^sqlite-jdbc-([0-9.]+\+([0-9]{8}|[0-9]{4}-[0-9]{2}-[0-9]{2}))-all\.jar$/\1/')
if [ -z "$ver" ] || [ "$ver" == "$(basename "$jar_path")" ]; then echo "::error::Could not extract version from JAR filename" && exit 1; fi
echo "jar=$jar_path" >> "$GITHUB_OUTPUT"
echo "ver=$ver" >> "$GITHUB_OUTPUT"
echo "Extracted version: $ver"
# 6. Publishing
- name: Publish Nightly Release
uses: ncipollo/release-action@v1
with:
tag: "nightly-${{ steps.locate.outputs.ver }}"
name: "Nightly ${{ steps.locate.outputs.ver }}"
body: ${{ steps.changelog.outputs.notes }}
artifacts: ${{ steps.locate.outputs.jar }}
prerelease: true
makeLatest: true
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to GitHub Actions
uses: actions/upload-artifact@v4
with:
name: minecraft-sqlite-jdbc
path: ${{ steps.locate.outputs.jar }}
- name: Publish to Modrinth
uses: Kir-Antipov/[email protected]
with:
modrinth-id: ${{ vars.MODRINTH_ID }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-featured: true
modrinth-unfeature-mode: subset
files: ${{ steps.locate.outputs.jar }}
name: ${{ steps.locate.outputs.ver }}
version: ${{ steps.locate.outputs.ver }}
version-type: release
changelog: ${{ steps.changelog.outputs.notes }}
loaders: |
bukkit
spigot
paper
folia
purpur
forge
neoforge
quilt
fabric
game-versions: |
>=1.12.2
retry-attempts: 2
retry-delay: 10000
fail-mode: fail