mirror of
https://github.com/cupcakearmy/gitea-sync.git
synced 2025-09-06 18:50:41 +00:00
Compare commits
3 Commits
v1.0.0-rc.
...
v1.0.0
Author | SHA1 | Date | |
---|---|---|---|
cf19e698b3 | |||
a58e59c43b | |||
9abca53ab3 |
@@ -1,5 +1,4 @@
|
|||||||
GITHUB_TOKEN=
|
GITHUB_TOKEN=
|
||||||
GITHUB_SCOPE=
|
|
||||||
|
|
||||||
GITEA_HOST=
|
GITEA_HOST=
|
||||||
GITEA_TOKEN=
|
GITEA_TOKEN=
|
||||||
|
16
.github/workflows/docker.yaml
vendored
16
.github/workflows/docker.yaml
vendored
@@ -20,7 +20,8 @@ jobs:
|
|||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
ghcr.io/${{ github.repository }}
|
cupcakearmy/gitea-sync
|
||||||
|
# ghcr.io/${{ github.repository }}
|
||||||
# This assumes your repository is also github.com/foo/bar
|
# This assumes your repository is also github.com/foo/bar
|
||||||
# You could also use ghcr.io/foo/some-package as long as you are the user/org "foo"
|
# You could also use ghcr.io/foo/some-package as long as you are the user/org "foo"
|
||||||
tags: |
|
tags: |
|
||||||
@@ -28,12 +29,17 @@ jobs:
|
|||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
type=semver,pattern={{major}}
|
type=semver,pattern={{major}}
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
- name: Log in to Docker Hub
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
username: ${{ github.actor }}
|
password: ${{ secrets.DOCKER_TOKEN }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
# - name: Log in to the Container registry
|
||||||
|
# uses: docker/login-action@v2
|
||||||
|
# with:
|
||||||
|
# registry: ghcr.io
|
||||||
|
# username: ${{ github.actor }}
|
||||||
|
# password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
|
34
README.md
34
README.md
@@ -1,5 +1,39 @@
|
|||||||
# Backup Github repos to Gitea
|
# Backup Github repos to Gitea
|
||||||
|
|
||||||
|
Simple docker image that syncs your Github repos to a given Gitea server. It takes all the repos (public and private) and sets up a mirror. Private repos will stay a private mirror. Repos that are already setup will be skipped.
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
Create a `docker-compose.yaml` and `.env` (see `.env.sample`). Create and insert tokens and you are ready to go.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
sync:
|
||||||
|
image: cupcakearmy/gitea-sync:1
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file: .env
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Github PAT
|
||||||
|
# Also works with the new fine grained, read-only tokens
|
||||||
|
GITHUB_TOKEN=
|
||||||
|
|
||||||
|
# Host of the Gitea server
|
||||||
|
GITEA_HOST=
|
||||||
|
# Gitea token
|
||||||
|
GITEA_TOKEN=
|
||||||
|
|
||||||
|
# OPTIONAL
|
||||||
|
|
||||||
|
# Cron schedule
|
||||||
|
CRON="0 */2 * * *"
|
||||||
|
```
|
||||||
|
|
||||||
## Known limitations
|
## Known limitations
|
||||||
|
|
||||||
- Issues, PR, etc. can be imported, but [not for a mirror](https://github.com/go-gitea/gitea/issues/18369)
|
- Issues, PR, etc. can be imported, but [not for a mirror](https://github.com/go-gitea/gitea/issues/18369)
|
||||||
|
@@ -1,7 +1,11 @@
|
|||||||
|
# FOR DEVELOPMENT ONLY
|
||||||
|
# See README.md for an example
|
||||||
|
|
||||||
version: "3.8"
|
version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
job:
|
job:
|
||||||
|
image: cupcakearmy/gitea-sync
|
||||||
build: .
|
build: .
|
||||||
env_file: .env
|
env_file: .env
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "1.0.0-rc.0",
|
"version": "1.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node .",
|
"start": "node .",
|
||||||
|
@@ -38,12 +38,12 @@ export const Config = {
|
|||||||
level: getEnv('LOG_LEVEL', 'info'),
|
level: getEnv('LOG_LEVEL', 'info'),
|
||||||
},
|
},
|
||||||
github: {
|
github: {
|
||||||
scope: simple('GITHUB_SCOPE'),
|
|
||||||
token: simple('GITHUB_TOKEN'),
|
token: simple('GITHUB_TOKEN'),
|
||||||
},
|
},
|
||||||
gitea: {
|
gitea: {
|
||||||
host: simple('GITEA_HOST'),
|
host: simple('GITEA_HOST'),
|
||||||
token: simple('GITEA_TOKEN'),
|
token: simple('GITEA_TOKEN'),
|
||||||
},
|
},
|
||||||
|
cron: getEnv('CRON', '0 */2 * * *'),
|
||||||
version: getEnv('npm_package_version', 'unknown'),
|
version: getEnv('npm_package_version', 'unknown'),
|
||||||
}
|
}
|
||||||
|
@@ -7,4 +7,4 @@ import { logger } from './logger.js'
|
|||||||
logger.info(`Mirror manager - ${Config.version}`, { version: Config.version })
|
logger.info(`Mirror manager - ${Config.version}`, { version: Config.version })
|
||||||
|
|
||||||
await sync()
|
await sync()
|
||||||
cron.schedule('0/5 * * * *', sync)
|
cron.schedule(Config.cron, sync)
|
||||||
|
Reference in New Issue
Block a user