Repository navigation
81 lines (72 loc) · 3.05 KB
/
Copy pathsplit-packages.yml
File metadata and controls
81 lines (72 loc) · 3.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
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
name: Split Packages
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: split-packages
cancel-in-progress: false
permissions:
contents: read
jobs:
split-php:
name: Split PHP Package
runs-on: ubuntu-latest
steps:
- name: Checkout mono-repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Validate SPLIT_TOKEN
env:
SPLIT_TOKEN: ${{ secrets.SPLIT_TOKEN }}
run: |
if [[ -z "${SPLIT_TOKEN}" ]]; then
echo "::error::SPLIT_TOKEN secret is not set or empty"
exit 1
fi
- name: Split and push packages/php
env:
SPLIT_TOKEN: ${{ secrets.SPLIT_TOKEN }}
TARGET_REPO: ${{ github.repository_owner }}/${{ vars.PHP_REPO_NAME || 'safeaccess-inline-php' }}
run: |
echo "Target: ${TARGET_REPO}"
SHA=$(git subtree split --prefix=packages/php)
echo "Split SHA: ${SHA}"
git remote add split-php "https://x-access-token:${SPLIT_TOKEN}@github.com/${TARGET_REPO}.git" 2>/dev/null || true
git push split-php "${SHA}:refs/heads/main" --force 2>&1 || {
echo "::error::Push to ${TARGET_REPO} failed. Check that SPLIT_TOKEN has Contents read+write permission on the target repository."
exit 1
}
split-js:
name: Split JS Package
runs-on: ubuntu-latest
steps:
- name: Checkout mono-repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Validate SPLIT_TOKEN
env:
SPLIT_TOKEN: ${{ secrets.SPLIT_TOKEN }}
run: |
if [[ -z "${SPLIT_TOKEN}" ]]; then
echo "::error::SPLIT_TOKEN secret is not set or empty"
exit 1
fi
- name: Split and push packages/js
env:
SPLIT_TOKEN: ${{ secrets.SPLIT_TOKEN }}
TARGET_REPO: ${{ github.repository_owner }}/${{ vars.JS_REPO_NAME || 'safeaccess-inline-js' }}
run: |
echo "Target: ${TARGET_REPO}"
SHA=$(git subtree split --prefix=packages/js)
echo "Split SHA: ${SHA}"
git remote add split-js "https://x-access-token:${SPLIT_TOKEN}@github.com/${TARGET_REPO}.git" 2>/dev/null || true
git push split-js "${SHA}:refs/heads/main" --force 2>&1 || {
echo "::error::Push to ${TARGET_REPO} failed. Check that SPLIT_TOKEN has Contents read+write permission on the target repository."
exit 1
}