Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbfc227a55 | ||
|
|
5c247e9664 | ||
|
|
31531325f2 | ||
|
|
0e05f2f30f | ||
|
|
ed0b9b598d |
No files matched your search
@@ -17,3 +17,4 @@
|
|||||||
/ui export-ignore
|
/ui export-ignore
|
||||||
/phpunit.xml export-ignore
|
/phpunit.xml export-ignore
|
||||||
/pint.json export-ignore
|
/pint.json export-ignore
|
||||||
|
/out export-ignore
|
||||||
Executable
+51
@@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Puts the release tags of this repository on the Packagist mirror, as a clean tree.
|
||||||
|
#
|
||||||
|
# Packagist reads the mirror, not this repository. For every version tag on COMMIT_HASH this makes a commit in the
|
||||||
|
# mirror that holds what `git archive` of the tag gives (so without everything `.gitattributes` marks export-ignore:
|
||||||
|
# tests, dev, ui, TOKENS.md, the .gitea scripts, ...), with no parent and no branch, tags it with the same name and
|
||||||
|
# pushes only that tag. A tag that is already in the mirror is left alone, so running it again changes nothing.
|
||||||
|
#
|
||||||
|
# Environment: COMMIT_HASH (the commit that was released), MIRROR_URL (the mirror), MIRROR_TOKEN (a token that may
|
||||||
|
# push to it; leave empty for a local mirror). Run in a checkout that has the tags. Needs git and tar.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
: "${COMMIT_HASH:?COMMIT_HASH is required}" "${MIRROR_URL:?MIRROR_URL is required}"
|
||||||
|
SRC="$(pwd)"
|
||||||
|
|
||||||
|
tags="$(git -C "$SRC" tag --points-at "$COMMIT_HASH" --list 'v[0-9]*.[0-9]*.[0-9]*')"
|
||||||
|
if [ -z "$tags" ]; then
|
||||||
|
echo "$COMMIT_HASH has no version tag: nothing to put on the mirror."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
auth=()
|
||||||
|
[ -z "${MIRROR_TOKEN:-}" ] || auth=(-c "http.extraheader=Authorization: token ${MIRROR_TOKEN}")
|
||||||
|
|
||||||
|
WORK="$(mktemp -d)"
|
||||||
|
trap 'rm -rf "$WORK"' EXIT
|
||||||
|
git "${auth[@]}" clone --quiet --bare "$MIRROR_URL" "$WORK/mirror.git" 2>/dev/null || git init --quiet --bare "$WORK/mirror.git"
|
||||||
|
MIRROR="$WORK/mirror.git"
|
||||||
|
|
||||||
|
for tag in $tags; do
|
||||||
|
if git --git-dir="$MIRROR" rev-parse -q --verify "refs/tags/$tag" >/dev/null; then
|
||||||
|
echo "$tag is already on the mirror."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
tree_dir="$WORK/tree-$tag"
|
||||||
|
mkdir "$tree_dir"
|
||||||
|
git -C "$SRC" archive "$tag" | tar -x -C "$tree_dir"
|
||||||
|
|
||||||
|
when="$(git -C "$SRC" log -1 --format=%cI "$tag")"
|
||||||
|
export GIT_AUTHOR_NAME="deploy-bot" GIT_AUTHOR_EMAIL="[email protected]" GIT_AUTHOR_DATE="$when"
|
||||||
|
export GIT_COMMITTER_NAME="deploy-bot" GIT_COMMITTER_EMAIL="[email protected]" GIT_COMMITTER_DATE="$when"
|
||||||
|
export GIT_INDEX_FILE="$WORK/index-$tag"
|
||||||
|
git --git-dir="$MIRROR" --work-tree="$tree_dir" add -A
|
||||||
|
tree="$(git --git-dir="$MIRROR" write-tree)"
|
||||||
|
commit="$(git --git-dir="$MIRROR" commit-tree "$tree" -m "$tag")"
|
||||||
|
unset GIT_INDEX_FILE
|
||||||
|
git --git-dir="$MIRROR" tag "$tag" "$commit"
|
||||||
|
git --git-dir="$MIRROR" "${auth[@]}" push --quiet "$MIRROR_URL" "refs/tags/$tag"
|
||||||
|
echo "$tag put on the mirror ($(git --git-dir="$MIRROR" ls-tree -r --name-only "$commit" | wc -l) files)."
|
||||||
|
done
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
import importlib.util
|
import importlib.util
|
||||||
import os
|
import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
@@ -153,6 +154,63 @@ class DependencyRelease(unittest.TestCase):
|
|||||||
self.assertTrue(release.release_is_open(branches + ["release/v0.5.1"], (0, 5, 0)))
|
self.assertTrue(release.release_is_open(branches + ["release/v0.5.1"], (0, 5, 0)))
|
||||||
|
|
||||||
|
|
||||||
|
class MirrorTags(unittest.TestCase):
|
||||||
|
SCRIPT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "mirror_tags.sh")
|
||||||
|
|
||||||
|
def git(self, cwd, *args):
|
||||||
|
env = {**os.environ, "GIT_AUTHOR_NAME": "t", "GIT_AUTHOR_EMAIL": "t@t", "GIT_COMMITTER_NAME": "t", "GIT_COMMITTER_EMAIL": "t@t"}
|
||||||
|
return subprocess.run(["git", *args], cwd=cwd, env=env, capture_output=True, text=True, check=True).stdout.strip()
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
self.dir = tempfile.TemporaryDirectory()
|
||||||
|
base = self.dir.name
|
||||||
|
self.src, self.mirror = os.path.join(base, "src"), os.path.join(base, "mirror.git")
|
||||||
|
os.makedirs(os.path.join(self.src, "src"))
|
||||||
|
os.makedirs(os.path.join(self.src, "tests"))
|
||||||
|
self.git(base, "init", "--bare", "--quiet", self.mirror)
|
||||||
|
self.git(base, "init", "--quiet", self.src)
|
||||||
|
for name, text in {"composer.json": "{}", "src/A.php": "a", "tests/T.php": "t", "TOKENS.md": "x",
|
||||||
|
".gitattributes": "/tests export-ignore\n/TOKENS.md export-ignore\n/.gitattributes export-ignore\n"}.items():
|
||||||
|
with open(os.path.join(self.src, name), "w") as handle:
|
||||||
|
handle.write(text)
|
||||||
|
self.git(self.src, "add", "-A")
|
||||||
|
self.git(self.src, "commit", "-q", "-m", "one")
|
||||||
|
self.git(self.src, "tag", "v1.0.0")
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.dir.cleanup()
|
||||||
|
|
||||||
|
def run_script(self, commit):
|
||||||
|
return subprocess.run(["bash", self.SCRIPT], cwd=self.src, capture_output=True, text=True,
|
||||||
|
env={**os.environ, "COMMIT_HASH": commit, "MIRROR_URL": self.mirror})
|
||||||
|
|
||||||
|
def test_a_tag_goes_over_as_a_clean_tree_without_a_branch_or_history(self):
|
||||||
|
result = self.run_script(self.git(self.src, "rev-parse", "HEAD"))
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertEqual(self.git(self.mirror, "tag", "--list"), "v1.0.0")
|
||||||
|
self.assertEqual(self.git(self.mirror, "branch", "--list"), "")
|
||||||
|
self.assertEqual(self.git(self.mirror, "ls-tree", "-r", "--name-only", "v1.0.0").split(), ["composer.json", "src/A.php"])
|
||||||
|
self.assertEqual(self.git(self.mirror, "rev-list", "--count", "v1.0.0"), "1")
|
||||||
|
|
||||||
|
def test_running_it_again_changes_nothing(self):
|
||||||
|
commit = self.git(self.src, "rev-parse", "HEAD")
|
||||||
|
self.run_script(commit)
|
||||||
|
first = self.git(self.mirror, "rev-parse", "v1.0.0")
|
||||||
|
self.assertEqual(self.run_script(commit).returncode, 0)
|
||||||
|
self.assertEqual(self.git(self.mirror, "rev-parse", "v1.0.0"), first)
|
||||||
|
|
||||||
|
def test_a_commit_without_a_version_tag_is_left_alone(self):
|
||||||
|
with open(os.path.join(self.src, "src", "B.php"), "w") as handle:
|
||||||
|
handle.write("b")
|
||||||
|
self.git(self.src, "add", "-A")
|
||||||
|
self.git(self.src, "commit", "-q", "-m", "two")
|
||||||
|
result = self.run_script(self.git(self.src, "rev-parse", "HEAD"))
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertEqual(self.git(self.mirror, "tag", "--list"), "")
|
||||||
|
|
||||||
|
|
||||||
class PackagistNotice(unittest.TestCase):
|
class PackagistNotice(unittest.TestCase):
|
||||||
def run_notice(self, answers):
|
def run_notice(self, answers):
|
||||||
"""Runs notify() with fake answers per endpoint (a status number, or an HTTP error code as a string)."""
|
"""Runs notify() with fake answers per endpoint (a status number, or an HTTP error code as a string)."""
|
||||||
|
|||||||
@@ -67,7 +67,9 @@ jobs:
|
|||||||
COMMIT_HASH: ${{ github.sha }}
|
COMMIT_HASH: ${{ github.sha }}
|
||||||
|
|
||||||
# Packagist shows every branch of the repository it reads as a dev version (dev-develop, dev-feature/...), and
|
# 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.
|
# that cannot be switched off. So it reads a mirror that only has tags: for every version tag of this release
|
||||||
|
# mirror_tags.sh puts a clean tree there (what `git archive` gives: no tests, no TOKENS.md, no dev scripts),
|
||||||
|
# with no branch and no history. This repository can stay private; the mirror is what the world sees.
|
||||||
mirror:
|
mirror:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
needs: tag
|
needs: tag
|
||||||
@@ -79,13 +81,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: push the tags
|
- name: clean tags to the mirror
|
||||||
run: |
|
run: |
|
||||||
git config --global --add safe.directory "$(pwd)"
|
git config --global --add safe.directory "$(pwd)"
|
||||||
git config --local --unset-all http.https://git.iriks.casa/.extraheader || true
|
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*'
|
.gitea/scripts/mirror_tags.sh
|
||||||
env:
|
env:
|
||||||
GT_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
|
COMMIT_HASH: ${{ github.sha }}
|
||||||
|
MIRROR_URL: https://git.iriks.casa/iriks-it/laravel-manager-packagist.git
|
||||||
|
MIRROR_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
|
||||||
|
|
||||||
# Needs the secrets PACKAGIST_USERNAME and PACKAGIST_TOKEN on the repository, and the package
|
# 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.
|
# submitted on packagist.org once. Without them this step only says so.
|
||||||
|
|||||||
@@ -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
|
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.
|
the section is the text of the release in Gitea.
|
||||||
|
|
||||||
|
## v0.5.2 - 2026-12-04
|
||||||
|
|
||||||
|
- The mirror for Packagist gets a clean tree per release (no tests, `ui/`, `dev/`, `TOKENS.md`, `.gitea/` or agent files), with no history and no
|
||||||
|
branch, so `composer require` installs less and this repository can be private. `mirror_tags.sh`, with tests; `out/` is export-ignored too.
|
||||||
|
|
||||||
## v0.5.1 - 2026-12-04
|
## 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),
|
- 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),
|
||||||
|
|||||||
@@ -277,9 +277,12 @@ Nothing here runs on a weekly schedule; the checks hang on the moments that matt
|
|||||||
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`:
|
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.
|
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
|
Packagist reads the mirror `iriks-it/laravel-manager-packagist`, not this repository, because it shows every branch of the
|
||||||
Release workflow pushes them), because Packagist shows every branch of the repository it reads as a `dev-…` version. The
|
repository it reads as a `dev-…` version. For every release the Release workflow (`.gitea/scripts/mirror_tags.sh`) puts a clean
|
||||||
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.
|
tree on the mirror: what `git archive` of the tag gives, so without what `.gitattributes` marks `export-ignore` (tests, `ui/`,
|
||||||
|
`dev/`, `TOKENS.md`, `.gitea/`, the agent files), as a commit with no history and no branch, and pushes only its tag. The mirror
|
||||||
|
has one branch, `production`, that only holds a note (no `composer.json`, so no version); nothing else is ever pushed there. Packagist
|
||||||
|
and `composer require` only see the mirror, so this repository can be private. (Versions up to v0.5.1 on the mirror are the full tree.)
|
||||||
|
|
||||||
Secrets of the repository for this: `DEPLOY_TOKEN` (the organisation has it), and `PACKAGIST_USERNAME` and
|
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
|
`PACKAGIST_TOKEN` (until they are set that step only says so). When Packagist does not know the package yet, that step
|
||||||
|
|||||||
@@ -49,3 +49,4 @@ Per stuk werk een rij; zie `dev/token-usage.py`.
|
|||||||
| 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 | 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 | 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 |
|
| 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 |
|
||||||
|
| 2026-12-04 | Schone spiegel voor Packagist: alleen de pakketbestanden per tag, zonder historie | - | claude-sonnet-5-5 | 83 | 43.432 | 230 | 61.540 | 14.760.529 | 0,39 |
|
||||||
Reference in new issue
Block a user