aboutsummaryrefslogtreecommitdiff
path: root/.gitea/workflows/mirror.yml
blob: e3ba10649ab962668f9b6ee63ac268a31970c6e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Mirror repository
on:
  push:
    branches:
      - master
  schedule:
    - cron: '0 */6 * * *'
  workflow_dispatch: {}
jobs:
  build:
    if: github.ref == 'refs/heads/master'
    runs-on: ubuntu-latest
    container:
      image: gitea.segundo.io/docker/ci-base:latest
      credentials:
        username: "${GITEA_REGISTRY_TOKEN}"
        password: "${GITEA_REGISTRY_USER}"
    steps:

    - uses: actions/checkout@v5
      with:
        fetch-depth: 0
        fetch-tags: true

    - name: Set up SSH
      run: |
        mkdir ~/.ssh
        echo $GIT_SEGUNDO_IO_SSH_KEY_PUB > ~/.ssh/id_rsa.pub
        echo $GIT_SEGUNDO_IO_SSH_KEY_PRIV | base64 -d > ~/.ssh/id_rsa
        chmod 600 ~/.ssh/id_rsa*
        ssh-keyscan git.segundo.io >> ~/.ssh/known_hosts

    - name: Set up Git
      run: |
        git config --global user.name "gitea"
        git config --global user.email "gitea@segundo.io"
        git remote add mirror git@git.segundo.io:osx-jiggler

    - name: Mirror to git.segundo.io
      run: |
        git checkout master
        git checkout wiki
        git push --mirror mirror