-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (38 loc) · 1.77 KB
/
Copy pathsplit.yaml
File metadata and controls
48 lines (38 loc) · 1.77 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
name: split
on:
workflow_call:
secrets:
GH_TOKEN:
required: true
jobs:
split:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get branch name
id: branch
shell: bash
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
- name: Publish split.json to public mirror
run: |
REPO_NAME="${GITHUB_REPOSITORY##*/}"
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
git config --global user.name "GitHub Action"
git config --global user.email "action@github.com"
git clone --depth=1 --single-branch --branch master https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/ozo2003/components.git public-mirror
mkdir -p "public-mirror/$REPO_NAME"
cp .github/split.json "public-mirror/$REPO_NAME/$BRANCH_NAME.json"
cd public-mirror
git add .
git commit -m "Update $REPO_NAME/$BRANCH_NAME.json" || echo "No changes to commit"
git push
- name: Wait for push to settle
run: sleep 5
- name: Run split
uses: docker://ghcr.io/960018/action-split:latest
env:
BRANCH: ${{ steps.branch.outputs.branch }}
REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
COMPONENTS_URL: https://raw.githubusercontent.com/ozo2003/components/master/${{ github.event.repository.name }}/${{ steps.branch.outputs.branch }}.json