name: Build & Publish Package on: push: tags: - "v*.*.*" # triggers on version tags like v0.1.0, v1.2.3 workflow_dispatch: # allows manual trigger from the Gitea UI jobs: publish: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v5 - name: Build Gitea package run: | # Keep the public/PyPI distribution as real-browser-cli in the repo, # but publish the private Gitea package under browser-cli. python - <<'PY' from pathlib import Path replacements = { Path("pyproject.toml"): ( 'name = "real-browser-cli"', 'name = "browser-cli"', ), Path("browser_cli/constants.py"): ( 'PYPI_PACKAGE_NAME = "real-browser-cli"', 'PYPI_PACKAGE_NAME = "browser-cli"', ), } for path, (old, new) in replacements.items(): text = path.read_text() if old not in text: raise SystemExit(f"expected text not found in {path}: {old}") path.write_text(text.replace(old, new, 1)) PY uv build - name: Publish to Gitea run: | uv publish \ --publish-url "${{ vars.REGISTRY_URL }}/api/packages/${{ github.repository_owner }}/pypi" \ --username "${{ github.repository_owner }}" \ --password "${{ secrets.ACTION_ACCESS_TOKEN }}"