-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (42 loc) · 1.32 KB
/
Copy pathsplit-php.yml
File metadata and controls
47 lines (42 loc) · 1.32 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
name: Split PHP SDK
on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:
jobs:
split:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.SPLIT_APP_ID }}
private-key: ${{ secrets.SPLIT_APP_PRIVATE_KEY }}
owner: EZSCALE
- name: Split and push branch
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
SHA=$(git subtree split --prefix=php/ HEAD)
git init --bare /tmp/split-target
cd /tmp/split-target
git remote add origin "https://github.com/EZSCALE/virtfusion-php.git"
git config "http.https://github.com/.extraheader" "Authorization: Basic $(echo -n "x-access-token:${GH_TOKEN}" | base64)"
git fetch "$GITHUB_WORKSPACE" "${SHA}":refs/heads/main
git push origin main --force
- name: Mirror tag
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG="${GITHUB_REF#refs/tags/}"
SHA=$(git subtree split --prefix=php/ HEAD)
cd /tmp/split-target
git tag "${TAG}" "${SHA}"
git push origin "${TAG}"