Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danharrin/monorepo-split-github-action
Github Action for Monorepo Split
https://github.com/danharrin/monorepo-split-github-action
github-actions monorepo split
Last synced: 4 days ago
JSON representation
Github Action for Monorepo Split
- Host: GitHub
- URL: https://github.com/danharrin/monorepo-split-github-action
- Owner: danharrin
- Created: 2020-11-14T11:56:22.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-17T14:18:25.000Z (3 months ago)
- Last Synced: 2024-09-25T15:37:51.485Z (8 days ago)
- Topics: github-actions, monorepo, split
- Language: PHP
- Homepage:
- Size: 130 KB
- Stars: 100
- Watchers: 6
- Forks: 36
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GitHub Action for Monorepo Split
**Version 2.0 now supports split to GitHub and Gitlab private repositories!**
Do you have [a monorepo](https://tomasvotruba.com/cluster/monorepo-from-zero-to-hero/) project on GitHub and need split packages to many repositories? Add this GitHub Action to your workflow and let it split your packages on every commit and tag.
### How does the Split Result Look Like?
This repository splits tests into [symplify/monorepo-split-github-action-test](https://github.com/symplify/monorepo-split-github-action-test) repository.
Not on every commit, but only if contents of `/tests/packages/some-package` directory changes.
Try it yourself - send PR with change in [that directory](/tests/packages/some-package).
## Docs
- [How to Use on Gitlab](docs/how_to_use_on_gitlab.md)
## Config
Split is basically git push or local directory to remote git repository. This remote repository can be located on GitHub or Gitlab. To be able to do that, it needs `GITHUB_TOKEN` or `GITLAB_TOKEN` with write repository access:
```yaml
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# or
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
```Make sure to add this access token in "Secrets" of package settings at https://github.com///settings/environments
## Define your GitHub Workflow
```yaml
name: 'Packages Split'on:
push:
branches:
- main
tags:
- '*'env:
# 1. for Github split
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}# 2. for Gitlab split
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}jobs:
packages_split:
runs-on: ubuntu-lateststrategy:
fail-fast: false
matrix:
# define package to repository map
package:
-
local_path: 'easy-coding-standard'
split_repository: 'easy-coding-standard'steps:
- uses: actions/checkout@v2# no tag
-
if: "!startsWith(github.ref, 'refs/tags/')"
uses: "symplify/[email protected]"
with:
# ↓ split "packages/easy-coding-standard" directory
package_directory: 'packages/${{ matrix.package.local_path }}'# ↓ into https://github.com/symplify/easy-coding-standard repository
repository_organization: 'symplify'
repository_name: '${{ matrix.package.split_repository }}'# [optional, with "github.com" as default]
repository_host: git.private.com:1234# ↓ the user signed under the split commit
user_name: "kaizen-ci"
user_email: "[email protected]"# with tag
-
if: "startsWith(github.ref, 'refs/tags/')"
uses: "symplify/[email protected]"
with:
tag: ${GITHUB_REF#refs/tags/}# ↓ split "packages/easy-coding-standard" directory
package_directory: 'packages/${{ matrix.package.local_path }}'# ↓ into https://github.com/symplify/easy-coding-standard repository
repository_organization: 'symplify'
repository_name: '${{ matrix.package.split_repository }}'# [optional, with "github.com" as default]
repository_host: git.private.com:1234# ↓ the user signed under the split commit
user_name: "kaizen-ci"
user_email: "[email protected]"
```