diff --git a/.forgejo/workflows/wheelhouse.yml b/.forgejo/workflows/wheelhouse.yml index 8051e1e..7684732 100644 --- a/.forgejo/workflows/wheelhouse.yml +++ b/.forgejo/workflows/wheelhouse.yml @@ -23,6 +23,15 @@ on: # All Odoo series branches: 16.0, 17.0, 18.0, ... # Deliberately excludes 16.0-ocabot-* / feature branches. - "*.0" + # Manual trigger (Actions tab -> "Run workflow"). Use force_all=true to + # build & publish every addon regardless of the changed-files diff -- handy + # for seeding the registry on the very first run. + workflow_dispatch: + inputs: + force_all: + description: "Build & publish ALL addons (ignore the changed-files diff)" + type: boolean + default: false jobs: wheelhouse: @@ -40,32 +49,43 @@ jobs: curl -LsSf https://astral.sh/uv/install.sh | sh echo "$HOME/.local/bin" >> "$GITHUB_PATH" - - name: Determine changed addons + - name: Determine addons to build id: changed run: | set -euo pipefail - before="${{ github.event.before }}" - # On the first push to a branch (or a force-push), `before` is all - # zeros / unreachable; fall back to the parent commit. - if [ -z "$before" ] || ! git cat-file -e "${before}^{commit}" 2>/dev/null ; then - before="$(git rev-parse HEAD~1 2>/dev/null || true)" - fi - if [ -n "$before" ]; then - changed_files="$(git diff --name-only "$before" HEAD)" - else - changed_files="$(git ls-files)" - fi - # Reduce to top-level addon dirs that actually changed and are addons. + force="${{ github.event.inputs.force_all || 'false' }}" addons="" - for addon in */ ; do - name="${addon%/}" - if [ -f "${addon}__manifest__.py" ] && [ -f "${addon}pyproject.toml" ] \ - && echo "$changed_files" | grep -q "^${name}/" ; then - addons="${addons} ${name}" + if [ "$force" = "true" ]; then + # Forced run: build every addon, ignore the diff. + for addon in */ ; do + name="${addon%/}" + if [ -f "${addon}__manifest__.py" ] && [ -f "${addon}pyproject.toml" ]; then + addons="${addons} ${name}" + fi + done + else + before="${{ github.event.before }}" + # On the first push to a branch (or a force-push), `before` is all + # zeros / unreachable; fall back to the parent commit. + if [ -z "$before" ] || ! git cat-file -e "${before}^{commit}" 2>/dev/null ; then + before="$(git rev-parse HEAD~1 2>/dev/null || true)" fi - done + if [ -n "$before" ]; then + changed_files="$(git diff --name-only "$before" HEAD)" + else + changed_files="$(git ls-files)" + fi + # Reduce to top-level addon dirs that actually changed and are addons. + for addon in */ ; do + name="${addon%/}" + if [ -f "${addon}__manifest__.py" ] && [ -f "${addon}pyproject.toml" ] \ + && echo "$changed_files" | grep -q "^${name}/" ; then + addons="${addons} ${name}" + fi + done + fi addons="$(echo "$addons" | xargs || true)" - echo "Changed addons:${addons:- (none)}" + echo "Addons to build:${addons:- (none)}" echo "addons=${addons}" >> "$GITHUB_OUTPUT" - name: Build wheels for changed addons