Skip to content

Commit

Permalink
Merge pull request #10 from boxuk/monorepo-split-action
Browse files Browse the repository at this point in the history
Use SplitSH to split monorepo
  • Loading branch information
jdamner authored May 24, 2024
2 parents e252f8d + 9ff63d6 commit a4ee213
Showing 1 changed file with 13 additions and 28 deletions.
41 changes: 13 additions & 28 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
push:
branches:
- main
tags:
- "*"
# tags: # Todo - handle tags, ie publishing a new version from the mono-repo to all the sub-repos.
# - "*"

permissions:
contents: write
Expand Down Expand Up @@ -40,30 +40,15 @@ jobs:
- name: Remove `/packages/*/build` from gitignore
run: |
sed -i '/\/packages\/\*\/build/d' .gitignore
# no tag
- name: Split Monorepo
if: "!startsWith(github.ref, 'refs/tags/')"
uses: "symplify/monorepo-split-github-action@v2.3.0"
env:
GITHUB_TOKEN: ${{ secrets.BOXUK_WP_ROBOT_ACCESS_TOKEN }}
with:
package_directory: "packages/${{ matrix.packages.local_path }}"
repository_organization: "boxuk"
repository_name: "${{ matrix.packages.target_repo }}"
user_name: "BoxUK Automated Package Management"
user_email: "developers@boxuk.com"
# with tag
- name: Split Monorepo with Tag
if: "startsWith(github.ref, 'refs/tags/')"
uses: "symplify/monorepo-split-github-action@v2.3.0"
env:
GITHUB_TOKEN: ${{ secrets.BOXUK_WP_ROBOT_ACCESS_TOKEN }}
with:
tag: ${GITHUB_REF#refs/tags/}
package_directory: "packages/${{ matrix.packages.local_path }}"
repository_organization: "boxuk"
repository_name: "${{ matrix.packages.target_repo }}"
user_name: "BoxUK Automated Package Management"
user_email: "developers@boxuk.com"
- name: Install Splitsh
shell: bash
run: |
apt-get update && apt-get install -y libgit2 golang-go
go build -o splitsh-lite github.com/splitsh/lite
- name: Split MonoRepo
shell: bash
run: |
git remote add ${{ matrix.packages.target_repo }} git@github.com:boxuk/${{ matrix.packages.target_repo }}.git || true
SHA1=`splitsh-lite --prefix=pacakges/${{ matrix.packages.local_path }}`
git push ${{ matrix.packages.target_repo }} "$SHA1:refs/heads/main" -f

0 comments on commit a4ee213

Please sign in to comment.