Skip to content

Commit d8440dc

Browse files
committed
Overengineer buildscript
1 parent fe258ab commit d8440dc

File tree

3 files changed

+50
-19
lines changed

3 files changed

+50
-19
lines changed

.github/workflows/auto-bump-jdbc.yml

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
env:
17-
BOT_NAME: "Axionize (automation)"
17+
BOT_NAME: "Axionize"
1818
BOT_EMAIL: "[email protected]"
1919

2020
steps:
@@ -37,6 +37,10 @@ jobs:
3737
echo "latest=$latest"
3838
echo "latest=$latest" >> "$GITHUB_OUTPUT"
3939
40+
# 2½) Make the version available as an env var
41+
- name: Export NEW_VER
42+
run: echo "NEW_VER=${{ steps.maven.outputs.latest }}" >> $GITHUB_ENV
43+
4044
# ─────────────────────────────────────────────────────────
4145
# 3) Current version in gradle.properties
4246
# ─────────────────────────────────────────────────────────
@@ -47,13 +51,33 @@ jobs:
4751
echo "current=$current"
4852
echo "current=$current" >> "$GITHUB_OUTPUT"
4953
54+
# 3½) Export NEW_VER (already in your file)
55+
- name: Export NEW_VER
56+
run: echo "NEW_VER=${{ steps.maven.outputs.latest }}" >> $GITHUB_ENV
57+
5058
# ─────────────────────────────────────────────────────────
5159
# 4) Exit early if nothing to update
5260
# ─────────────────────────────────────────────────────────
5361
- name: Skip if up‑to‑date
5462
if: ${{ steps.maven.outputs.latest == steps.current.outputs.current }}
5563
run: echo "Nothing to bump — already on ${{ steps.current.outputs.current }}."
5664

65+
# 5) Bump version & release_date ── we already compute TODAY here
66+
- name: Bump version & release date
67+
id: bump
68+
if: ${{ steps.maven.outputs.latest != steps.current.outputs.current }}
69+
run: |
70+
set -e
71+
TODAY=$(date -u +%F) # 2024-06-08
72+
echo "TODAY=$TODAY" >> $GITHUB_ENV # ← make it available later
73+
74+
sed -i "s/^library_version=.*/library_version=${{ steps.maven.outputs.latest }}/" gradle.properties
75+
if grep -q '^release_date=' gradle.properties; then
76+
sed -i "s/^release_date=.*/release_date=${TODAY}/" gradle.properties
77+
else
78+
echo "release_date=${TODAY}" >> gradle.properties
79+
fi
80+
5781
# ---------------------------------------------------------------------
5882
# 5) OPTION A → Commit directly to main (UNCOMMENT to use)
5983
# ---------------------------------------------------------------------
@@ -73,23 +97,28 @@ jobs:
7397
# ---------------------------------------------------------------------
7498
# 5/6) OPTION B → PR + auto‑merge (DEFAULT below)
7599
# ---------------------------------------------------------------------
76-
- name: Open PR & auto‑merge # ← default: option B
100+
# 6) Create or update the PR
101+
- name: Create PR
102+
id: create-pr
77103
if: ${{ steps.maven.outputs.latest != steps.current.outputs.current }}
78104
uses: peter-evans/create-pull-request@v5
79105
with:
80-
token: ${{ secrets.GITHUB_TOKEN }}
81-
branch: bump-sqlite-${{ steps.maven.outputs.latest }}
82-
commit-message: "chore: bump sqlite-jdbc to ${{ steps.maven.outputs.latest }}"
106+
token: ${{ secrets.GITHUB_TOKEN }}
107+
branch: bump-sqlite-${{ steps.maven.outputs.latest }}
108+
add-paths: gradle.properties
109+
commit-message: "chore: bump sqlite-jdbc to ${{ steps.maven.outputs.latest }} (released ${{ env.TODAY }})"
83110
title: "chore: bump sqlite-jdbc to ${{ steps.maven.outputs.latest }}"
84111
body: |
85-
Automated bump from **${{ steps.current.outputs.current }}**
86-
to **${{ steps.maven.outputs.latest }}**.
87-
88-
This PR will merge itself once CI passes.
89-
labels: dependencies, automated
112+
Automated bump
113+
• **library_version** → `${{ steps.maven.outputs.latest }}`
114+
• **release_date** → `${{ env.TODAY }}`
90115
delete-branch: true
91-
# ----- auto‑merge controls -----
92-
merge: true # merge right after CI succeeds
93-
merge-method: squash
94116
author: "${{ env.BOT_NAME }} <${{ env.BOT_EMAIL }}>"
95-
committer: "${{ env.BOT_NAME }} <${{ env.BOT_EMAIL }}>"
117+
committer: "${{ env.BOT_NAME }} <${{ env.BOT_EMAIL }}>"
118+
119+
# 7) Enable auto‑merge
120+
- name: Enable PR auto‑merge
121+
if: ${{ steps.create-pr.outputs.pull-request-number }}
122+
run: gh pr merge --squash --auto "${{ steps.create-pr.outputs.pull-request-number }}"
123+
env:
124+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/gradle.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
# …and once a day at 04:00 UTC (if uncommented)
99
# schedule:
1010
# - cron: '0 4 * * *'
11+
workflow_run:
12+
workflows: ["Auto‑Bump SQLite‑JDBC"]
13+
types: [completed]
1114

1215
jobs:
1316
build-and-release:
@@ -56,10 +59,9 @@ jobs:
5659
set -e
5760
jar=$(ls -1 build/libs/*-all.jar | head -n1)
5861
echo "jar=$jar" >>"$GITHUB_OUTPUT"
59-
60-
# pull the version part out of the filename:
61-
# sqlite-jdbc-3.49.1.0+20250420-all.jar -> 3.49.1.0+20250420
62-
ver=$(basename "$jar" | sed -E 's/^sqlite-jdbc-([^+]+(\+[0-9]+)?)-all\.jar$/\1/')
62+
63+
# Handles both YYYYMMDD and YYYY-MM-DD dates
64+
ver=$(basename "$jar" | sed -E 's/^sqlite-jdbc-([0-9.]+\+[0-9]{8}|[0-9.]+\+[0-9]{4}-[0-9]{2}-[0-9]{2})-all\.jar$/\1/')
6365
echo "ver=$ver" >>"$GITHUB_OUTPUT"
6466
6567
# ─────────────────────────────────────────────────────────────

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ library_name=sqlite-jdbc
1515
library_maven_name=org.xerial:sqlite-jdbc
1616
library_version=3.41.2.1
1717

18-
release_date=20230506
18+
release_date=2023-05-06

0 commit comments

Comments
 (0)