Skip to content

Migrating to ci-backup #552

Open
Open

Description

@josegonzalez

I think the next step here is migrating this to the ci-backup org. I've invited @Iamrodos to it, but we'll need to figure out the path forward in regards to package publishing.

@Iamrodos do you know off the top of your head what the most secure way to do this is? Ideally its some sort of bot account or something that I can setup/control but isn't tied to my normal python account (so we can't escalate perms to other repos I publish). Or maybe there is some sort of Github App workflow that pypi supports to join a given repo to a given pypi package?

Once we figure that out, I'll migrate this and python-gitlab-backup over and grant you maintainer perms so you can review/merge/release PRs for this.

Activity

  1. Iamrodos commented on Nov 19, 2026

    @Iamrodos
    Contributor

    Thanks, accepted the invite.

    PyPI has exactly this: Trusted Publishing. You tell PyPI which GitHub repo, workflow file and environment may publish the project. The workflow run gets a 15 minute token scoped to that one project. No bot account and no stored secret, so nothing that can reach your other packages. You stay the only owner on PyPI and I don't need a PyPI account at all.

    I set it up on a small package of mine today to prove it end to end: https://github.com/draylabs/dray/blob/main/.github/workflows/release.yml

    To set trusted publishing up in the new org the steps would be:

    1. On PyPI, github-backup → Settings → Publishing, add a GitHub publisher: owner ci-backup, repo name, workflow filename, environment pypi. PyPI let me do this before my repo existed.
    2. In the repo settings, create a pypi environment with required reviewers. The publish job waits for an approval, so that list decides who can release.
    3. Move the upload out of ./release into a job with id-token: write running pypa/gh-action-pypi-publish (example).
    4. Then delete the TWINE_USERNAME and TWINE_PASSWORD secrets and revoke that token on PyPI. This one is yours. Secrets travel with a transferred repo, and a token keeps working alongside a trusted publisher until it is revoked.

    One gotcha that caught me: the environment name is optional on PyPI's form. Leave it blank and PyPI takes an upload from that workflow with no environment, so the approval is only as strong as the workflow file. See their security notes.

    Docker is the one thing users will notice. Images belong to the account, not the repo, and don't move with a transfer. New ones would go to ghcr.io/ci-backup/python-github-backup, and ghcr.io/josegonzalez/python-github-backup keeps serving what it has and stops updating. I'd leave the old one public so pinned versions keep working, and put the new path in the README. Could also publish to both for a few releases. The old package has a "Manage Actions access" setting where you might be able to give the moved repo write access. Not sure GitHub allows that across owners, I haven't tried it.

    For letting people know, the GitHub release and CHANGES.rst are built from commit messages. So if the README change is titled "Docker image moves to ghcr.io/ci-backup/python-github-backup" it shows up in both, and on PyPI, with nothing extra to write.

    pip install github-backup is unaffected and the old GitHub URLs redirect.

    Happy to do the PR for step 3 once the repo has moved. It would drop the workflow's use of the TWINE_* secrets too, so step 4 can follow it.

  2. josegonzalez commented on Nov 19, 2026

    @josegonzalez
    OwnerAuthor

    If we move the repo, wouldn't that kill the ghcr images?

  3. Iamrodos commented on Nov 19, 2026

    @Iamrodos
    Contributor

    This is an area I don't have much experience with, but as far as I can tell they should survive. On ghcr the images belong to your account, not the repo. GitHub's docs say "the account associated with the package does not change when you transfer a repository", it only removes the link between the package and the repo.

    So I'd expect ghcr.io/josegonzalez/python-github-backup to keep serving the tags it has now. What I think changes is that the moved repo can't push to it any more, so new releases would land at ghcr.io/ci-backup/python-github-backup and the old path would stop at 0.68.0.

    Two projects that did the same move:

    • ghcr.io/jorenn92/maintainerr is still public and pullable, frozen at 2.19.0. New releases go to ghcr.io/maintainerr/maintainerr, now at 3.32.0.
    • ghcr.io/fallenbagel/jellyseerr is still public and pullable, frozen at 2.7.3. New releases go to ghcr.io/seerr-team/seerr, now at 3.5.2.
  4. josegonzalez commented on Nov 19, 2026

    @josegonzalez
    OwnerAuthor

    Alright cool. I think I'll have time for this on Friday afternoon. Will start setting things up on the PyPI side there.

  5. josegonzalez commented on Nov 19, 2026

    @josegonzalez
    OwnerAuthor

    Should we rename that org to something else? It'll cover this repo and python-gitlab-backup.

  6. Iamrodos commented on Nov 19, 2026

    @Iamrodos
    Contributor

    I did think the name was strange with CI at the start. What about forge-backup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions