Skip to content

Commit

Permalink
ci: add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
christophstockinger committed Nov 13, 2024
1 parent dbfffad commit a6faaaf
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/split.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Split Monorepo

on:
workflow_dispatch:
push:
branches:
- mtd/split
# schedule:
# - cron: '0 2 * * 0' # Run weekly on Sunday at 2 AM (adjust as needed)

jobs:
split-repo:
runs-on: ubuntu-latest

steps:
- name: Checkout Monorepo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set Up Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Split Backend Repo
env:
BACKEND_REPO_URL: https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/${{ secrets.BACKENd_REPO }}.git
run: |
# Clone only the backend directory with history
git clone --no-checkout $GITHUB_SERVER_URL/$GITHUB_REPOSITORY backend-split
cd backend-split
git filter-repo --path backend/ --path-rename backend/:/
git remote add backend $BACKEND_REPO_URL
git push --force backend main
- name: Split Frontend Repo
env:
FRONTEND_REPO_URL: https://github-actions:${{ secrets.GITHUB_TOKEN }}@github.com/${{ secrets.FRONTEND_REPO }}.git
run: |
# Clone only the frontend directory with history
git clone --no-checkout $GITHUB_SERVER_URL/$GITHUB_REPOSITORY frontend-split
cd frontend-split
git filter-repo --path frontend/ --path-rename frontend/:/
git remote add frontend $FRONTEND_REPO_URL
git push --force frontend main

0 comments on commit a6faaaf

Please sign in to comment.