fix: add main forgejo sync workflow
This commit is contained in:
parent
6887e64ddb
commit
9c472ce9a5
1 changed files with 40 additions and 0 deletions
40
.github/workflows/sync-to-forgejo.yml
vendored
Normal file
40
.github/workflows/sync-to-forgejo.yml
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
name: sync-to-forgejo
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- high-performance
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Push branch to Forgejo
|
||||
env:
|
||||
FORGEJO_SECRET: ${{ secrets.FORGEJO_SECRET || secrets.GITEA_SECRET }}
|
||||
FORGEJO_OWNER: ${{ secrets.FORGEJO_OWNER || 'ashwin' }}
|
||||
FORGEJO_USERNAME: ${{ secrets.FORGEJO_USERNAME || secrets.GITEA_USERNAME || 'ashwin' }}
|
||||
REPO: ${{ github.event.repository.name }}
|
||||
BRANCH: ${{ github.ref_name }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "${FORGEJO_SECRET:-}" || { echo "FORGEJO_SECRET is empty"; exit 1; }
|
||||
|
||||
ENCODED_PASSWORD="$(printf '%s' "${FORGEJO_SECRET}" | jq -sRr @uri)"
|
||||
TARGET="https://${FORGEJO_USERNAME}:${ENCODED_PASSWORD}@ci.nxtgauge.com/${FORGEJO_OWNER}/${REPO}.git"
|
||||
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git remote remove forgejo 2>/dev/null || true
|
||||
git remote add forgejo "${TARGET}"
|
||||
|
||||
git push forgejo "HEAD:${BRANCH}" --force
|
||||
git push forgejo --tags --force
|
||||
Loading…
Add table
Reference in a new issue