Skip to content

Merge pull request #7 from jblemee/main #26

Merge pull request #7 from jblemee/main

Merge pull request #7 from jblemee/main #26

Workflow file for this run

name: Nightly Release
on:
# Trigger on pushes to main (covers manual pushes, other non-bot pushes)
push:
branches: [ main ]
# ***CHANGED***: Trigger ONLY when Auto-Bump sends the specific dispatch event
repository_dispatch:
types: [sqlite_jdbc_bumped] # Matches event_type sent by Auto-Bump
# ***REMOVED***: No longer need workflow_run trigger
# workflow_run:
# workflows: ["Auto‑Bump SQLite‑JDBC"]
# types: [completed]
# Optional: Keep schedule if you want independent nightly builds
# schedule:
# - cron: '0 4 * * *'
jobs:
build-and-release:
# No complex 'if' condition needed at the job level anymore,
# the triggers themselves filter correctly.
runs-on: ubuntu-latest
env:
# These are less critical now but good practice
BOT_NAME: "Axionize (automation)"
BOT_EMAIL: "Axionize+bot@example.com"
steps:
# ─────────────────────────────────────────────────────────────
# 1. Check out sources (ensure it gets the code AFTER the bump)
# ─────────────────────────────────────────────────────────────
- uses: actions/checkout@v3
with:
# When triggered by dispatch/push, checkout should get the latest commit
# that includes the bump. fetch-depth: 0 might be needed if release notes use history.
ref: 'main' # Explicitly checkout main
# ─────────────────────────────────────────────────────────────
# ***REMOVED***: No longer need the run_condition check step
# ─────────────────────────────────────────────────────────────
# ─────────────────────────────────────────────────────────────
# 2. JDK8 + Gradle cache (Runs unconditionally now when job starts)
# ─────────────────────────────────────────────────────────────
- name: Set up JDK8
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '8'
cache: gradle
# ─────────────────────────────────────────────────────────────
# 3. Validate wrapper
# ─────────────────────────────────────────────────────────────
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
# ─────────────────────────────────────────────────────────────
# 4. Build shaded JAR
# ─────────────────────────────────────────────────────────────
- 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 in build/libs/"
exit 1
fi
echo "jar=$jar_path" >>"$GITHUB_OUTPUT"
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: $(basename "$jar_path")"
exit 1
fi
echo "ver=$ver" >>"$GITHUB_OUTPUT"
echo "Extracted version: $ver from $jar_path"
# ─────────────────────────────────────────────────────────────
# 6. Create/update a version‑tagged release
# ─────────────────────────────────────────────────────────────
- name: Publish nightly release
# Only condition now is that locate step must succeed
if: steps.locate.outputs.ver != ''
uses: ncipollo/release-action@v1
with:
tag: nightly-${{ steps.locate.outputs.ver }}
name: Nightly ${{ steps.locate.outputs.ver }}
artifacts: ${{ steps.locate.outputs.jar }}
prerelease: true
makeLatest: true
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}