Skip to content

Latest commit

 

History

History
83 lines (58 loc) · 2.38 KB

README.rst

File metadata and controls

83 lines (58 loc) · 2.38 KB

Gentoo crate-dist mirroring action

This is a GitHub action to maintain a "crate-dist" mirror. It fetches new tags from upstream, adds a workflow based on crate-dist-action and pushes them to the repository. This workflow creates a crate tarball using pycargoebuild, creates a release matching the tag and uploads the crate tarball there.

Note: due to technical limitations of GitHub, this action needs to push to the repository via SSH rather than HTTPS. Otherwise, the added workflow is not triggered.

Inputs

ssh-private-key
The private key used to push to the repository. It needs to have write access. Required.
directories
Space-separated list of directories to pass to pycargoebuild. Defaults to . (i.e. the top directory of the repository).
upstream-repo
URL to the upstream repository. Needed only when mirroring a non-GitHub repository. When unset, the "parent" for the current repository will be used (i.e. the repository it was forked from).

Usage

    1. If source is on GitHub, fork it.
    2. Otherwise, use the "Import repository" function to create it.
  1. Get a deployment SSH key. You can either create a dedicated deployment key for the repository, or create a bot account with an associated key.

  2. Add the public SSH key as deployment key for the repository with write access, or give the bot user write access.

  3. Add an Actions secret with the private SSH key.

  4. Create a new empty branch for the workflow:

    git checkout --orphan crate-dist
    git reset --hard
    
  5. Create a GitHub workflow for the mirroring (see Example workflow), commit it and push it.

  6. Switch the default branch on the repository to your newly created branch (e.g. crate-dist) and enable Actions.

  7. If you want crate dist created for an existing tag, remove it from the mirror.

Example workflow

name: Sync with upstream
on:
  schedule:
    - cron: "12 * * * *"

jobs:
  sync-mirror:
    runs-on: ubuntu-latest
    steps:
      - name: Update mirror
        uses: projg2/crate-dist-mirror-action@v2
        with:
          ssh-private-key: ${{ secrets.ssh_key }}
          upstream-repo: https://gitlab.gnome.org/World/fractal.git