forgejo-release-mirror

command module
v0.0.0-...-4e0b22f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2025 License: MPL-2.0 Imports: 15 Imported by: 0

README

Forgejo Release Mirror

Forgejo Release Mirror is a small (~10MB) Golang program that mirrors releases and their assets from one Forgejo instance to another one. It is useful when combined with Forgejo's built-in mirror system and tools like regclient (regsync) to create a complete mirror of a repository on Forgejo.

This was primarily created for the Continuwuity project, since we have a lot of mirrors, and already mirrored container images, but wanted to also mirror the releases and their assets. If you use Matrix and want to run your own server, you should check out that project!

[!WARNING] ONLY Forgejo (and possibly Gitea) are supported. GitHub is NOT supported.

Installing

You can install with go install:

go install codeberg.org/timedout/forgejo-release-mirror@dev

Or compile from source:

git clone https://codeberg.org/timedout/forgejo-release-mirror.git
cd forgejo-release-mirror
go build -o forgejo-release-mirror .

There is also an OCI image available:

docker build -t codeberg.org/timedout/forgejo-release-mirror:dev .

Usage

There are no command-line arguments, this program is entirely operated by environment variables:

Variable Description Required Default
SOURCE_DOMAIN The domain of the origin Forgejo instance where releases will be pulled from. Yes N/A
SOURCE_REPO The repository on the source Forgejo instance in the format owner/repo. Yes N/A
SOURCE_AUTH Authentication for the source Forgejo instance in the format username:token. Optional, but required for private repositories, and for remote user mapping by email. No
TARGET_DOMAIN The domain of the target Forgejo instance where releases will be pushed to. Yes N/A
TARGET_REPO The repository on the target Forgejo instance in the format owner/repo. Yes N/A
TARGET_AUTH Authentication for the target Forgejo instance in the format username:token. Optional, but required for private repositories. No
MAX_SIZE_MIB Maximum size of assets to transfer in MiB. Assets larger than this size will be skipped. No 100
DISABLE_USER_MAPPING Disabling looking up users on the target instance by their source email. No
GitHub Actions (or similar)

You can use this program in a GitHub Actions workflow (or similar CI/CD system) to automate mirroring releases from one Forgejo instance to another one. Here is an example workflow:

jobs:
  mirror-releases:
    runs-on: ubuntu-latest
    steps:
      - name: Mirror Releases
        uses: codeberg.org/timedout/forgejo-release-mirror@dev  # replace "dev" with a commit hash, ideally
        with:
          # Replace these with your actual domains and repo paths
          source_domain: "forgejo.example.com"
          source_repo: "owner/source-repo"
          target_domain: "git.example.com"
          target_repo: "owner/target-repo"

          # Authentication: store tokens in repository or organization secrets and reference them here
          target_auth: "${{ secrets.TARGET_AUTH }}"  # required: username:token
          source_auth: "${{ secrets.SOURCE_AUTH }}"  # optional: username:token (needed for private repos / user mapping)

          # Optional flags
          only_tag: ""                # optionally mirror only a specific tag
          disable_user_mapping: "false" # set to "true" to skip user mapping behavior
          max_size_mib: "100"         # maximum asset size to transfer in MiB (default 100)

Documentation

Overview

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL