Compare commits

...
Author SHA1 Message Date
lil-koneko 0e05f2f30f Merge pull request 'Release v0.5.1' (#49) from release/v0.5.1 into production
Release / verify (push) Successful in 34s
Release / tag (push) Successful in 7s
Release / mirror (push) Successful in 6s
Release / packagist (push) Successful in 4s
Release / sync-develop (push) Successful in 7s
Reviewed-on: #49
2026-12-04 09:07:36 +00:00
deploy-bot ed0b9b598d Merge pull request 'Tekst over de spiegel voor Packagist rechtgezet' (#48) from fix/mirror-wording into release/v0.5.1
PR CI / ledger (pull_request) Successful in 10s
PR CI / flow (pull_request) Successful in 10s
PR CI / security (pull_request) Successful in 34s
PR CI / test (lowest) (pull_request) Successful in 49s
PR CI / ui (pull_request) Successful in 53s
PR CI / test (stable) (pull_request) Successful in 57s
PR CI / pr-ci (pull_request) Successful in 2s
PR CI / release-automerge (pull_request) Skipped
2026-12-04 09:05:52 +00:00
Matthijs Iriks 70e8287fca Say what the Packagist mirror holds
PR CI / ledger (pull_request) Successful in 5s
PR CI / flow (pull_request) Successful in 6s
PR CI / ui (pull_request) Successful in 18s
PR CI / security (pull_request) Successful in 25s
PR CI / test (lowest) (pull_request) Successful in 50s
PR CI / test (stable) (pull_request) Successful in 49s
PR CI / pr-ci (pull_request) Successful in 2s
PR CI / release-automerge (pull_request) Successful in 5s
2026-12-04 10:04:51 +01:00
deploy-bot c50c75cebb Merge pull request 'Packagist leest een spiegel met alleen tags' (#47) from feature/packagist-tags-only into release/v0.5.1 2026-12-04 09:02:01 +00:00
Matthijs Iriks 62602a9843 Packagist reads a mirror that only has the tags
PR CI / ledger (pull_request) Successful in 9s
PR CI / flow (pull_request) Successful in 10s
PR CI / ui (pull_request) Successful in 19s
PR CI / security (pull_request) Successful in 26s
PR CI / test (lowest) (pull_request) Successful in 47s
PR CI / test (stable) (pull_request) Successful in 55s
PR CI / pr-ci (pull_request) Successful in 2s
PR CI / release-automerge (pull_request) Successful in 5s
2026-12-04 09:58:32 +01:00
lil-koneko afad275408 Merge pull request 'Release v0.5.0' (#43) from release/v0.5.0 into production
Release / verify (push) Successful in 31s
Release / tag (push) Successful in 5s
Release / packagist (push) Successful in 4s
Release / sync-develop (push) Successful in 7s
Reviewed-on: #43
2026-12-04 08:53:09 +00:00
deploy-bot 2063f52698 Merge pull request 'Patch-release voor de nachtelijke renovate-update' (#46) from feature/renovate-patch-release into release/v0.5.0
PR CI / flow (pull_request) Successful in 6s
PR CI / ledger (pull_request) Successful in 7s
PR CI / security (pull_request) Successful in 20s
PR CI / ui (pull_request) Successful in 23s
PR CI / test (lowest) (pull_request) Successful in 34s
PR CI / test (stable) (pull_request) Successful in 43s
PR CI / pr-ci (pull_request) Successful in 3s
PR CI / release-automerge (pull_request) Skipped
2026-12-04 08:50:23 +00:00
Matthijs Iriks 45f4ed2660 Make a patch release of a merged renovate pull request
PR CI / flow (pull_request) Successful in 10s
PR CI / ledger (pull_request) Successful in 9s
PR CI / ui (pull_request) Successful in 19s
PR CI / security (pull_request) Successful in 26s
PR CI / test (lowest) (pull_request) Successful in 48s
PR CI / test (stable) (pull_request) Successful in 54s
PR CI / pr-ci (pull_request) Successful in 3s
PR CI / release-automerge (pull_request) Successful in 4s
2026-12-04 09:49:11 +01:00
deploy-bot fc51dd5bdb Merge pull request 'Niets meer wekelijks: nachtelijke scan en updates, Trivy na een release' (#45) from feature/nightly-not-weekly into release/v0.5.0
PR CI / ledger (pull_request) Successful in 9s
PR CI / flow (pull_request) Successful in 6s
PR CI / security (pull_request) Successful in 27s
PR CI / test (lowest) (pull_request) Successful in 36s
PR CI / test (stable) (pull_request) Successful in 45s
PR CI / ui (pull_request) Successful in 1m12s
PR CI / pr-ci (pull_request) Successful in 3s
PR CI / release-automerge (pull_request) Skipped
2026-12-04 08:42:57 +00:00
7 changed files with 125 additions and 22 deletions

No files matched your search

+2 -2
View File
@@ -10,8 +10,8 @@ Pull requests go to a release branch or to production, never to develop.
and the pull request does not come from production, develop or another release branch.
- to `production`: only from `release/vX.Y.Z`, with a version above the latest tag, a section
for it in CHANGELOG.md, and no "version" in composer.json (Packagist reads the tag).
The one other way in is `renovate/*`: the nightly dependency update of the homelab (it makes no release;
the change reaches develop with the next sync).
The one other way in is `renovate/*`: the nightly dependency update of the homelab (release.py makes a
patch release of it, unless a release branch is open).
Environment: BASE_REF, HEAD_REF. Run in a checkout with the tags (fetch-depth 0).
Standard library + git only.
+68 -14
View File
@@ -6,8 +6,14 @@ finds that version (from the pull request Gitea knows for the commit, or from th
and makes the release `vX.Y.Z` on that commit, with the changelog section as its text. Gitea
makes the tag; Packagist picks the tag up in the next step.
The other way into production is the nightly dependency update of the homelab, a pull request from
`renovate/*`. That makes a patch release too: the version above the latest tag with the patch raised by
one (v0.5.0 -> v0.5.1), its text the title and description of the pull request. Renovate makes one pull
request per night, so that is at most one patch release a night. When a release branch is open (a version
above the latest tag) it makes none: the update goes out with that release.
Runs again on the same commit without harm: a tag that is already there on that commit is fine.
A push that is not a release merge (a hotfix pushed by an admin, say) makes no release and says so.
A push that is neither (a hotfix pushed by an admin, say) makes no release and says so.
Environment: GT_URL, GT_OWNER, GT_REPO, GT_TOKEN (may create releases), COMMIT_HASH.
Standard library + git only.
@@ -48,9 +54,13 @@ def api(method, path, body=None, allow=()):
return json.loads(text) if text else None
def release_branch_of(commit):
def pull_of(commit):
"""The pull request that made this commit, or None."""
return api("GET", f"commits/{commit}/pull", allow=(404,))
def release_branch_of(commit, pull=None):
"""The release branch whose pull request made this commit, or None."""
pull = api("GET", f"commits/{commit}/pull", allow=(404,))
head = ((pull or {}).get("head") or {}).get("ref", "")
if semver.release_version(head):
return head
@@ -61,15 +71,67 @@ def release_branch_of(commit):
return found.group(1) if found else None
def next_patch(newest):
"""v0.5.0 -> (0, 5, 1); None without a tag to count from."""
return None if newest is None else (newest[0], newest[1], newest[2] + 1)
def release_is_open(branches, newest):
"""True when one of the branches is a release/vX.Y.Z above the latest tag."""
return any((v := semver.release_version(b)) and (newest is None or v > newest) for b in branches)
def dependency_release(commit, pull):
"""Makes the patch release for a merged renovate/* pull request; says why when it makes none."""
tags = subprocess.run(["git", "tag", "--list", "v*"], capture_output=True, text=True).stdout.split()
already = subprocess.run(["git", "tag", "--points-at", commit], capture_output=True, text=True).stdout.split()
if any(semver.tag_version(tag) for tag in already):
print(f"{commit[:8]} is already tagged ({' '.join(already)}): nothing to do.")
return
newest = semver.latest(tags)
version = next_patch(newest)
if version is None:
print("No tag to count from: no release made.")
return
branches = [b["name"] for b in api("GET", "branches?limit=100") or []]
if release_is_open(branches, newest):
print("A release branch is open: this update goes out with it, no patch release made.")
return
tag = f"v{semver.text(version)}"
title = (pull.get("title") or "Dependency update").strip()
body = (pull.get("body") or "").strip()
notes = f"- {title}" + (f"\n\n{body}" if body else "")
publish(tag, commit, notes)
def publish(tag, commit, notes):
api("POST", "releases", {
"tag_name": tag,
"target_commitish": commit,
"name": tag,
"body": notes,
"draft": False,
"prerelease": False,
})
print(f"Released {tag} on {commit[:8]}.")
def main():
if not (URL and OWNER and REPO and TOKEN):
sys.exit("GT_URL, GT_OWNER, GT_REPO and GT_TOKEN are required.")
if not re.fullmatch(r"[0-9a-f]{40}", COMMIT):
sys.exit("COMMIT_HASH must be the full commit hash.")
branch = release_branch_of(COMMIT)
pull = pull_of(COMMIT)
branch = release_branch_of(COMMIT, pull)
if branch is None:
print(f"{COMMIT[:8]} is not the merge of a release/vX.Y.Z pull request: no release made.")
if ((pull or {}).get("head") or {}).get("ref", "").startswith("renovate/"):
dependency_release(COMMIT, pull)
else:
print(f"{COMMIT[:8]} is not the merge of a release/vX.Y.Z or renovate/* pull request: no release made.")
return
version = semver.release_version(branch)
@@ -85,15 +147,7 @@ def main():
if notes is None:
sys.exit(f"CHANGELOG.md has no section for {tag}: the release pull request should have been stopped by PR CI.")
api("POST", "releases", {
"tag_name": tag,
"target_commitish": COMMIT,
"name": tag,
"body": notes,
"draft": False,
"prerelease": False,
})
print(f"Released {tag} on {COMMIT[:8]}.")
publish(tag, COMMIT, notes)
if __name__ == "__main__":
+14
View File
@@ -11,6 +11,7 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import check_flow # noqa: E402
import packagist # noqa: E402
import prune_branches # noqa: E402
import release # noqa: E402
import semver # noqa: E402
TAGS = ["v0.1.0", "v0.2.0", "v0.10.0", "not-a-version"]
@@ -139,6 +140,19 @@ class HermesTokens(unittest.TestCase):
self.assertTrue(self.hermes.lines(per_model, "Work", "2026-12-04", "", None)[0].endswith("| 4.000 | |"))
class DependencyRelease(unittest.TestCase):
def test_the_next_patch(self):
self.assertEqual(release.next_patch((0, 5, 0)), (0, 5, 1))
self.assertEqual(release.next_patch((1, 2, 9)), (1, 2, 10))
self.assertIsNone(release.next_patch(None))
def test_an_open_release_takes_the_update_with_it(self):
branches = ["production", "develop", "release/v0.4.0", "release/v0.5.0", "renovate/deps-1"]
self.assertFalse(release.release_is_open(branches, (0, 5, 0)))
self.assertTrue(release.release_is_open(branches, (0, 4, 0)))
self.assertTrue(release.release_is_open(branches + ["release/v0.5.1"], (0, 5, 0)))
class PackagistNotice(unittest.TestCase):
def run_notice(self, answers):
"""Runs notify() with fake answers per endpoint (a status number, or an HTTP error code as a string)."""
+23 -2
View File
@@ -66,11 +66,32 @@ jobs:
GT_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
COMMIT_HASH: ${{ github.sha }}
# Packagist shows every branch of the repository it reads as a dev version (dev-develop, dev-feature/...), and
# that cannot be switched off. So it reads a mirror that only has the tags: this puts them there.
mirror:
runs-on: docker
needs: tag
container:
image: webdevops/php:8.4
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: push the tags
run: |
git config --global --add safe.directory "$(pwd)"
git config --local --unset-all http.https://git.iriks.casa/.extraheader || true
git -c http.extraheader="Authorization: token ${GT_TOKEN}" push https://git.iriks.casa/iriks-it/laravel-manager-packagist.git 'refs/tags/v*:refs/tags/v*'
env:
GT_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
# Needs the secrets PACKAGIST_USERNAME and PACKAGIST_TOKEN on the repository, and the package
# submitted on packagist.org once. Without them this step only says so.
packagist:
runs-on: docker
needs: tag
needs: [tag, mirror]
container:
image: webdevops/php:8.4
steps:
@@ -82,7 +103,7 @@ jobs:
env:
PACKAGIST_USERNAME: ${{ secrets.PACKAGIST_USERNAME }}
PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }}
PACKAGE_URL: https://git.iriks.casa/iriks-it/laravel-manager
PACKAGE_URL: https://git.iriks.casa/iriks-it/laravel-manager-packagist
# Last: merge what was released into develop. Runs even when Packagist could not be told.
sync-develop:
+7 -1
View File
@@ -4,6 +4,11 @@ Every release has a section here, named after its version (for example `v0.1.0 -
heading). The release pull request to `production` is stopped by PR CI when its section is missing, and the text of
the section is the text of the release in Gitea.
## v0.5.1 - 2026-12-04
- Packagist shows only the releases: the Release workflow pushes the tags to a mirror (`iriks-it/laravel-manager-packagist`) that has only a `production` branch with a note (no `composer.json`, so no version),
and Packagist reads that, so the `dev-…` versions of every branch are gone.
## v0.5.0 - 2026-12-04
- Names that can move: `route_name` for the route-name prefix, `tables` for a table of its own per short name (on top of `table_prefix`),
@@ -37,7 +42,8 @@ the section is the text of the release in Gitea.
with its own roles say what an account may do; groups stay the default.
- CI: nothing runs weekly any more, and Trivy no longer runs in the jobs (the runner disk filled up with its database). `composer audit` stays in every
pull request and every release; Trivy scans production from the homelab, every night and after every release. The nightly dependency round of the
homelab replaces the weekly *Dependency updates* workflow (and `update_dependencies.py`); its `renovate/*` pull requests may go to `production`.
homelab replaces the weekly *Dependency updates* workflow (and `update_dependencies.py`); its `renovate/*` pull requests may go to `production` and
become a patch release of their own (one a night at most, none while a release branch is open).
- `manager:doctor` has a `names` check: it warns when the site uses a route name or an address of the manager and says to set `route_name` or `path`.
## v0.4.0 - 2026-12-04
+8 -3
View File
@@ -261,7 +261,7 @@ Nobody opens a pull request to `develop`, and `production` and the release branc
| When | What runs |
|---|---|
| Pull request to a release branch or to production | *flow* (right branches, version above the latest tag, changelog section, tests of these scripts), *ledger* (`TOKENS.md`), *test* (Pint, Pest with the newest and the oldest dependencies, `composer validate`), *security* (`composer audit`: the job fails on any advisory). The check `PR CI / pr-ci` is green when all are. |
| Push to production | verify (Pest, `composer audit`), tag and release, Packagist, sync develop; then the homelab scans production with Trivy |
| Push to production | verify (Pest, `composer audit`), tag and release, the tags to the mirror `laravel-manager-packagist`, Packagist, sync develop; then the homelab scans production with Trivy |
| Every night | the homelab scans every repository with Trivy (03:00) and updates its dependencies (04:00): nothing runs weekly in this repository |
| Every night | *Prune branches*: removes `feature/*` and `fix/*` branches whose last commit is over 30 days old and that have no open pull request (a branch of a pull request can be restored from it in Gitea) |
@@ -273,8 +273,13 @@ Nothing here runs on a weekly schedule; the checks hang on the moments that matt
- **Every release:** `composer audit` again on the merge to `production`.
- **After every release to production:** Trivy scans `production` from the homelab (LXC 120, no database to download in a job).
- **Every night:** Trivy scans every repository of the organisation (03:00), and the dependency round (04:00) opens a pull request
`renovate/deps-DATE` straight to `production` for updates that have been public for 48 hours. PR CI tests it; it makes no release
and reaches `develop` with the next sync. A critical advisory on the installed version skips the 48 hours.
`renovate/deps-DATE` straight to `production` for updates that have been public for 48 hours. PR CI tests it, and when it is
merged the Release workflow makes a patch release of it (v0.5.0 → v0.5.1, text from the pull request), tells Packagist and syncs `develop`:
one a night at most. While a release branch is open there is no patch release; the update goes out with that release. A critical advisory on the installed version skips the 48 hours.
Packagist reads the mirror `iriks-it/laravel-manager-packagist`, not this repository: it holds only the tags `vX.Y.Z` (the
Release workflow pushes them), because Packagist shows every branch of the repository it reads as a `dev-…` version. The
package page on Packagist points at the mirror; the one branch there (`production`) only holds a note and has no `composer.json`, so Packagist makes no version of it.
Secrets of the repository for this: `DEPLOY_TOKEN` (the organisation has it), and `PACKAGIST_USERNAME` and
`PACKAGIST_TOKEN` (until they are set that step only says so). When Packagist does not know the package yet, that step
+3
View File
@@ -46,3 +46,6 @@ Per stuk werk een rij; zie `dev/token-usage.py`.
| 2026-12-04 | Controle op namen die de site al gebruikt, en de documenten van 0.5.0 rechtgezet | - | claude-sonnet-5-5 | 9 | 7.281 | 18 | 12.115 | 2.881.457 | 0,03 |
| 2026-12-04 | Trivy uit de PR-jobs (schijf van de runners vol), opruimen en wekelijkse prune | - | claude-sonnet-5-5 | 20 | 9.723 | 44 | 94.863 | 1.460.150 | 0,15 |
| 2026-12-04 | Niets meer wekelijks: nachtelijke scan en updates, Trivy na een release, docs | - | claude-sonnet-5-5 | 27 | 19.377 | 58 | 41.226 | 2.879.048 | 0,63 |
| 2026-12-04 | Patch-release voor de nachtelijke renovate-update | - | claude-sonnet-5-5 | 24 | 17.609 | 54 | 35.165 | 3.038.359 | 0,16 |
| 2026-12-04 | Packagist leest een spiegel met alleen tags | - | claude-sonnet-5-5 | 51 | 31.329 | 126 | 55.366 | 7.158.212 | 0,31 |
| 2026-12-04 | Spiegelrepo voor Packagist gevuld en de tekst erover rechtgezet | - | claude-sonnet-5-5 | 44 | 19.908 | 126 | 27.524 | 7.248.418 | 0,18 |