-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (50 loc) · 2.05 KB
/
split-plugins.yml
File metadata and controls
56 lines (50 loc) · 2.05 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
name: Split Plugins
on:
push:
branches: [trunk]
paths:
- 'plugins/**'
workflow_dispatch:
permissions:
contents: read
jobs:
split:
name: Split ${{ matrix.plugin.dir }} → ${{ matrix.plugin.repo }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
plugin:
- { dir: 'internal-comments', repo: 'wp-internal-comments' }
- { dir: 'linked-orders-for-woocommerce', repo: 'wc-linked-orders' }
- { dir: 'locked-payment-methods-for-woocommerce', repo: 'wc-locked-payment-methods' }
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
# Don't install the credential helper that auths as github-actions[bot].
# We push to the split repos via PAT embedded in the URL — the helper
# would otherwise hijack the auth and fail with 403.
persist-credentials: false
- name: Install splitsh-lite
run: |
# v1.0.1 (2017) is the latest splitsh-lite release with a published
# linux/amd64 binary; v2.0.0 was tagged in 2023 with no assets attached.
# The tool's `--prefix` behavior hasn't materially changed since v1.
curl -fsSL -o splitsh.tar.gz https://github.com/splitsh/lite/releases/download/v1.0.1/lite_linux_amd64.tar.gz
tar -xzf splitsh.tar.gz
sudo mv splitsh-lite /usr/local/bin/
rm splitsh.tar.gz
- name: Compute split SHA for plugins/${{ matrix.plugin.dir }}
id: split
run: |
SHA=$(splitsh-lite --prefix=plugins/${{ matrix.plugin.dir }})
echo "sha=$SHA" >> "$GITHUB_OUTPUT"
echo "Split SHA: $SHA"
- name: Push split to ahegyes/${{ matrix.plugin.repo }}
env:
TOKEN: ${{ secrets.MONOREPO_SPLIT_TOKEN }}
SPLIT_SHA: ${{ steps.split.outputs.sha }}
TARGET_REPO: ${{ matrix.plugin.repo }}
run: |
git push --force "https://x-access-token:${TOKEN}@github.com/ahegyes/${TARGET_REPO}.git" "${SPLIT_SHA}:refs/heads/trunk"