1+ name : Auto‑Bump SQLite‑JDBC
2+
3+ on :
4+ schedule : # every day at 05:00 UTC
5+ - cron : ' 0 5 * * *'
6+ workflow_dispatch : # manual “Run workflow” button
7+
8+ permissions :
9+ contents : write # push commits, create releases
10+ pull-requests : write # open / merge PRs
11+
12+ jobs :
13+ bump :
14+ runs-on : ubuntu-latest
15+
16+ env :
17+ BOT_NAME : " Axionize (automation)"
18+ 19+
20+ steps :
21+ # ─────────────────────────────────────────────────────────
22+ # 1) Checkout
23+ # ─────────────────────────────────────────────────────────
24+ - uses : actions/checkout@v3
25+ with :
26+ token : ${{ secrets.GITHUB_TOKEN }} # writeable token
27+
28+ # ─────────────────────────────────────────────────────────
29+ # 2) Latest version on Maven Central
30+ # ─────────────────────────────────────────────────────────
31+ - name : Fetch newest sqlite‑jdbc
32+ id : maven
33+ run : |
34+ latest=$(curl -s \
35+ 'https://search.maven.org/solrsearch/select?q=g:%22org.xerial%22+AND+a:%22sqlite-jdbc%22&rows=1&wt=json' \
36+ | jq -r '.response.docs[0].latestVersion')
37+ echo "latest=$latest"
38+ echo "latest=$latest" >> "$GITHUB_OUTPUT"
39+
40+ # ─────────────────────────────────────────────────────────
41+ # 3) Current version in gradle.properties
42+ # ─────────────────────────────────────────────────────────
43+ - name : Read current version
44+ id : current
45+ run : |
46+ current=$(grep '^library_version=' gradle.properties | cut -d'=' -f2)
47+ echo "current=$current"
48+ echo "current=$current" >> "$GITHUB_OUTPUT"
49+
50+ # ─────────────────────────────────────────────────────────
51+ # 4) Exit early if nothing to update
52+ # ─────────────────────────────────────────────────────────
53+ - name : Skip if up‑to‑date
54+ if : ${{ steps.maven.outputs.latest == steps.current.outputs.current }}
55+ run : echo "Nothing to bump — already on ${{ steps.current.outputs.current }}."
56+
57+ # ---------------------------------------------------------------------
58+ # 5) OPTION A → Commit directly to main (UNCOMMENT to use)
59+ # ---------------------------------------------------------------------
60+ # - name: Bump + push to main # ← uncomment block to enable option A
61+ # if: ${{ steps.maven.outputs.latest != steps.current.outputs.current }}
62+ # env:
63+ # LATEST: ${{ steps.maven.outputs.latest }}
64+ # run: |
65+ # set -e
66+ # sed -i "s/^library_version=.*/library_version=${LATEST}/" gradle.properties
67+ # git config user.name "Axionize"
68+ # git config user.email "[email protected] " 69+ # git add gradle.properties
70+ # git commit -m "chore: bump sqlite-jdbc to ${LATEST}"
71+ # git push origin HEAD:main
72+
73+ # ---------------------------------------------------------------------
74+ # 5/6) OPTION B → PR + auto‑merge (DEFAULT below)
75+ # ---------------------------------------------------------------------
76+ - name : Open PR & auto‑merge # ← default: option B
77+ if : ${{ steps.maven.outputs.latest != steps.current.outputs.current }}
78+ uses : peter-evans/create-pull-request@v5
79+ 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 }}"
83+ title : " chore: bump sqlite-jdbc to ${{ steps.maven.outputs.latest }}"
84+ 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
90+ delete-branch : true
91+ # ----- auto‑merge controls -----
92+ merge : true # merge right after CI succeeds
93+ merge-method : squash
94+ author : " ${{ env.BOT_NAME }} <${{ env.BOT_EMAIL }}>"
95+ committer : " ${{ env.BOT_NAME }} <${{ env.BOT_EMAIL }}>"
0 commit comments