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.
- 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).
If source is on GitHub, fork it.
Otherwise, create a new repository, and mirror the contents over, i.e.:
git clone --mirror https://example.com/original-repo.git cd original-repo git push --mirror git@github.com:...
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.
Add the public SSH key as deployment key for the repository with write access, or give the bot user write access.
Add an Actions secret with the private SSH key.
Create a new empty branch for the workflow:
git checkout --orphan crate-dist git reset --hard
Create a GitHub workflow for the mirroring (see Example workflow), commit it and push it.
Switch the default branch on the repository to your newly created branch (e.g.
crate-dist
) and enable Actions.If you want crate dist created for an existing tag, remove it from the mirror.
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