-
Notifications
You must be signed in to change notification settings - Fork 1
114 lines (97 loc) · 3.61 KB
/
split.yml
File metadata and controls
114 lines (97 loc) · 3.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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