61 lines
1.9 KiB
YAML
61 lines
1.9 KiB
YAML
# Generated by KCL v1.42.0 - DO NOT EDIT
|
|
# Source: .forgejo/kcl-ci/main.k
|
|
# kcl-ci local: ~/stuff/gitrepos/wxs/actions/kcl-ci
|
|
# kcl-ci remote: https://git.wxs.ro/actions/kcl-ci
|
|
|
|
name: Mirror to Remote
|
|
'on':
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- '.forgejo/kcl-ci/**'
|
|
- prds/**
|
|
workflow_dispatch: {}
|
|
concurrency:
|
|
group: mirror-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
env:
|
|
READ_REPO_TOKEN: ${{ secrets.READ_REPO_TOKEN }}
|
|
jobs:
|
|
push-mirror:
|
|
name: Push to Mirror
|
|
runs-on: grunt
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://${{ secrets.READ_REPO_TOKEN }}@git.wxs.ro/xternal/checkout@v6.0.2
|
|
with:
|
|
fetch-depth: '0'
|
|
token: ${{ github.token }}
|
|
- name: Configure SSH for mirror
|
|
run: |-
|
|
mkdir -p ~/.ssh
|
|
echo "${MIRROR_SSH_KEY}" > ~/.ssh/mirror_key
|
|
chmod 600 ~/.ssh/mirror_key
|
|
ssh-keyscan codeberg.org >> ~/.ssh/known_hosts 2>/dev/null
|
|
export GIT_SSH_COMMAND="ssh -i ~/.ssh/mirror_key -o StrictHostKeyChecking=no"
|
|
env:
|
|
MIRROR_SSH_KEY: ${{ secrets.CODEBERG_MIRROR_SSH_KEY }}
|
|
- name: Prepare and push to mirror
|
|
run: |-
|
|
# Configure git identity for the staging commit
|
|
git config user.name "forgejo-actions[bot]"
|
|
git config user.email "noreply@forgejo-actions"
|
|
|
|
# Remove excluded paths
|
|
rm -rf .forgejo
|
|
rm -rf prds
|
|
|
|
# Commit cleaned tree (detached from source history)
|
|
git checkout -B mirror-staging
|
|
git add -A
|
|
git diff --cached --quiet || git commit -m "mirror: $(git log -1 --format='%h %s' main)"
|
|
|
|
# Push to remote via SSH
|
|
export GIT_SSH_COMMAND="ssh -i ~/.ssh/mirror_key -o StrictHostKeyChecking=no"
|
|
git remote add mirror git@codeberg.org:vtmocanu/claude-code-action.git
|
|
git push mirror mirror-staging:main --force
|
|
|
|
# Cleanup
|
|
rm -f ~/.ssh/mirror_key
|