Inital Release
This commit is contained in:
commit
92eb8ce651
|
@ -0,0 +1,31 @@
|
||||||
|
name: Test on Gitea
|
||||||
|
|
||||||
|
on:
|
||||||
|
delete:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check_preconditions:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
results: ${{ join(steps.*.outcome) }}
|
||||||
|
steps:
|
||||||
|
- id: secrets
|
||||||
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
TARGET_REPO_URL: ${{ secrets.TARGET_GITEA_REPO_URL }}
|
||||||
|
run: '[ -n "$SSH_PRIVATE_KEY" ] && [ -n "$TARGET_REPO_URL" ]'
|
||||||
|
mirroring:
|
||||||
|
needs: check_preconditions
|
||||||
|
if: "!contains(needs.check_preconditions.outputs.results, 'failure')"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
target_repo_url: ${{ secrets.TARGET_REPO_URL }}
|
|
@ -0,0 +1,30 @@
|
||||||
|
name: Test on Gitlab
|
||||||
|
on:
|
||||||
|
delete:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check_preconditions:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
results: ${{ join(steps.*.outcome) }}
|
||||||
|
steps:
|
||||||
|
- id: secrets
|
||||||
|
continue-on-error: true
|
||||||
|
env:
|
||||||
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
TARGET_REPO_URL: ${{ secrets.TARGET_GITLAB_REPO_URL }}
|
||||||
|
run: '[ -n "$SSH_PRIVATE_KEY" ] && [ -n "$TARGET_REPO_URL" ]'
|
||||||
|
mirroring:
|
||||||
|
needs: check_preconditions
|
||||||
|
if: "!contains(needs.check_preconditions.outputs.results, 'failure')"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
target_repo_url: ${{ secrets.TARGET_GITLAB_REPO_URL }}
|
|
@ -0,0 +1,11 @@
|
||||||
|
FROM alpine
|
||||||
|
|
||||||
|
RUN apk update && apk upgrade && \
|
||||||
|
apk add --no-cache git openssh git-lfs
|
||||||
|
|
||||||
|
RUN git lfs install
|
||||||
|
|
||||||
|
COPY mirror.sh /mirror.sh
|
||||||
|
COPY setup-ssh.sh /setup-ssh.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/mirror.sh"]
|
|
@ -0,0 +1,19 @@
|
||||||
|
name: "Git Sync Mirror"
|
||||||
|
description: "Mirror your repository into another repository (Gitea and GitLab)"
|
||||||
|
branding:
|
||||||
|
icon: "copy"
|
||||||
|
color: "yellow"
|
||||||
|
inputs:
|
||||||
|
ssh_private_key:
|
||||||
|
description: "SSH private key for ssh connection to the target repository"
|
||||||
|
required: false
|
||||||
|
target_repo_url:
|
||||||
|
description: "Target url"
|
||||||
|
required: true
|
||||||
|
ssh_username:
|
||||||
|
description: "Username for ssh connection"
|
||||||
|
required: false
|
||||||
|
default: "git"
|
||||||
|
runs:
|
||||||
|
using: 'docker'
|
||||||
|
image: 'Dockerfile'
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
/setup.sh
|
||||||
|
|
||||||
|
export GIT_SSH_COMMAND="ssh -v -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no -l $INPUT_SSH_USERNAME"
|
||||||
|
git remote add mirror "$INPUT_TARGET_REPO_URL"
|
||||||
|
git push --tags --force --prune mirror "refs/remotes/origin/*:refs/heads/*"
|
Loading…
Reference in New Issue