ci: try to split main repository into sub repositories #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: 'Packages Split' | |
on: | |
push: | |
branches: | |
- v2-unstable-* | |
- v2-unstable # Remove before releasing v2 | |
- master | |
tags: | |
- '*' | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
concurrency: | |
group: "Packages Split" | |
cancel-in-progress: false | |
jobs: | |
sub_packages: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
package: | |
- path: 'src/Core' | |
remote: 'knplabs/snappy-core' | |
- path: 'src/Bundle' | |
remote: 'knplabs/snappy-bundle' | |
- path: 'src/Backend/WkHtmlToPdf' | |
remote: 'knplabs/snappy-wkhtmltopdf' | |
steps: | |
- run: | | |
git config --global user.name "knpEdgar" | |
git config --global user.email "hello@knplabs.com" | |
- uses: actions/checkout@v2 | |
with: | |
path: ./monolyth | |
- run: mkdir ./readonly | |
- name: git clone | |
run: | | |
cd ./readonly | |
git clone -- https://${{ secrets.ACCESS_TOKEN }}@github.com/${{ matrix.package.remote }} . | |
git fetch | |
- name: cleanup | |
run: | | |
cp --verbose -ra ./readonly/.git ./monolyth/${{ matrix.package.path }}/.git | |
rm -rf ./readonly/* | |
- run: cp --verbose -ra ./monolyth/${{ matrix.package.path }}/* ./readonly | |
- run: ls -la ./readonly | |
- name: git add . | |
id: git_status | |
run: | | |
cd ./readonly | |
echo "STATUS=$(git status --porcelain)" >> $GITHUB_OUTPUT | |
git add . | |
- name: git commit | |
if: ${{ '' != steps.git_status.outputs.STATUS }} | |
run: | | |
cd ./monolyth | |
COMMIT_MESSAGE=$(git show -s --format=%B ${GITHUB_SHA}) | |
cd ../readonly | |
git commit --message "$COMMIT_ESSAGE" | |
- name: git push | |
if: ${{ '' != steps.git_status.outputs.STATUS }} | |
run: | | |
cd ./readonly | |
git push --quiet origin main | |
- name: git tag | |
if: "startsWith(github.ref, 'refs/tags/')" | |
run: | | |
cd ./readonly | |
git tag %s -m "${GITHUB_REF#refs/tags/}" | |
git push --quiet origin "${GITHUB_REF#refs/tags/}" |