Merge pull request #17 from simPod/narrow-int-arithmetic-rounding #26
Workflow file for this run
This file contains hidden or 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: "Split Monorepo" | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| tags: | |
| - "math/**" | |
| - "money/**" | |
| jobs: | |
| split_math: | |
| name: "Split - math" | |
| runs-on: "ubuntu-24.04" | |
| if: "github.ref_type == 'branch' || startsWith(github.ref_name, 'math/')" | |
| steps: | |
| - name: "Checkout code" | |
| uses: "actions/checkout@v6" | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: "Resolve reference" | |
| id: "ref" | |
| env: | |
| REF_NAME: ${{ github.ref_name }} | |
| REF_TYPE: ${{ github.ref_type }} | |
| run: | | |
| if [ "$REF_TYPE" = "tag" ]; then | |
| echo "name=${REF_NAME#math/}" >> "$GITHUB_OUTPUT" | |
| echo "is_tag=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "name=$REF_NAME" >> "$GITHUB_OUTPUT" | |
| echo "is_tag=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: "Install splitsh-lite" | |
| run: | | |
| mkdir -p /tmp/splitsh | |
| curl -sL https://github.com/splitsh/lite/releases/download/v1.0.1/lite_linux_amd64.tar.gz | tar xz -C /tmp/splitsh | |
| sudo mv /tmp/splitsh/splitsh-lite /usr/local/bin/splitsh-lite | |
| - name: "Split and push" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.SPLIT_TOKEN }} | |
| REMOTE: "https://github.com/simPod/phpstan-brick-math.git" | |
| REFERENCE: ${{ steps.ref.outputs.name }} | |
| IS_TAG: ${{ steps.ref.outputs.is_tag }} | |
| run: | | |
| git config --local --unset-all http.https://github.com/.extraheader || true | |
| SHA=$(splitsh-lite --prefix=math) | |
| REMOTE_URL="https://x-access-token:${GITHUB_TOKEN}@github.com/simPod/phpstan-brick-math.git" | |
| if [ "$IS_TAG" = "true" ]; then | |
| git tag -f "v${REFERENCE}" "$SHA" | |
| git push "$REMOTE_URL" "v${REFERENCE}" | |
| else | |
| git push "$REMOTE_URL" "$SHA:refs/heads/$REFERENCE" | |
| fi | |
| split_money: | |
| name: "Split - money" | |
| runs-on: "ubuntu-24.04" | |
| if: "github.ref_type == 'branch' || startsWith(github.ref_name, 'money/')" | |
| steps: | |
| - name: "Checkout code" | |
| uses: "actions/checkout@v6" | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: "Resolve reference" | |
| id: "ref" | |
| env: | |
| REF_NAME: ${{ github.ref_name }} | |
| REF_TYPE: ${{ github.ref_type }} | |
| run: | | |
| if [ "$REF_TYPE" = "tag" ]; then | |
| echo "name=${REF_NAME#money/}" >> "$GITHUB_OUTPUT" | |
| echo "is_tag=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "name=$REF_NAME" >> "$GITHUB_OUTPUT" | |
| echo "is_tag=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: "Install splitsh-lite" | |
| run: | | |
| mkdir -p /tmp/splitsh | |
| curl -sL https://github.com/splitsh/lite/releases/download/v1.0.1/lite_linux_amd64.tar.gz | tar xz -C /tmp/splitsh | |
| sudo mv /tmp/splitsh/splitsh-lite /usr/local/bin/splitsh-lite | |
| - name: "Split and push" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.SPLIT_TOKEN }} | |
| REMOTE: "https://github.com/simPod/phpstan-brick-money.git" | |
| REFERENCE: ${{ steps.ref.outputs.name }} | |
| IS_TAG: ${{ steps.ref.outputs.is_tag }} | |
| run: | | |
| git config --local --unset-all http.https://github.com/.extraheader || true | |
| SHA=$(splitsh-lite --prefix=money) | |
| REMOTE_URL="https://x-access-token:${GITHUB_TOKEN}@github.com/simPod/phpstan-brick-money.git" | |
| if [ "$IS_TAG" = "true" ]; then | |
| git tag -f "v${REFERENCE}" "$SHA" | |
| git push "$REMOTE_URL" "v${REFERENCE}" | |
| else | |
| git push "$REMOTE_URL" "$SHA:refs/heads/$REFERENCE" | |
| fi |