-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (106 loc) · 4.81 KB
/
Copy pathsync-all.yml
File metadata and controls
123 lines (106 loc) · 4.81 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
115
116
117
118
119
120
121
122
123
name: Sync All Repos
on:
push:
branches:
- main
- master
workflow_dispatch: # Permet de lancer manuellement
env:
GIT_USER_NAME: IsSlashy
GIT_USER_EMAIL: slashyfx@volta.team
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout main repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Git
run: |
git config --global user.name "${{ env.GIT_USER_NAME }}"
git config --global user.email "${{ env.GIT_USER_EMAIL }}"
- name: Set commit message
id: msg
run: |
# Use first line of commit message only, sanitized for shell safety
MSG=$(git log -1 --pretty=%s | head -c 200 | tr -d '"' | tr -d "'" | tr -d '`')
echo "msg=Sync: ${MSG}" >> $GITHUB_OUTPUT
- name: Detect changes
id: changes
run: |
# Get changed files
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || echo "")
echo "web=$(echo "$CHANGED_FILES" | grep -q '^apps/web/' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
echo "mobile=$(echo "$CHANGED_FILES" | grep -q '^apps/mobile/' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
echo "extension=$(echo "$CHANGED_FILES" | grep -q '^apps/extension/' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
echo "sdk=$(echo "$CHANGED_FILES" | grep -qE '^packages/(p01-js|specter-sdk)/' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
echo "Changed files:"
echo "$CHANGED_FILES"
- name: Sync p01-web
if: steps.changes.outputs.web == 'true' || github.event_name == 'workflow_dispatch'
run: |
echo "Syncing p01-web..."
cd apps/web
rm -rf .git 2>/dev/null || true
git init
git add -A
git commit -m "${{ steps.msg.outputs.msg }}"
git branch -M main
git remote add origin https://${{ secrets.PAT_TOKEN }}@github.com/IsSlashy/p01-web.git
git push -f origin main
echo "✓ p01-web synced"
- name: Sync p01-mobile
if: steps.changes.outputs.mobile == 'true' || github.event_name == 'workflow_dispatch'
run: |
echo "Syncing p01-mobile..."
cd apps/mobile
rm -rf .git node_modules android/app/build android/.gradle .expo 2>/dev/null || true
git init
git add -A
git commit -m "${{ steps.msg.outputs.msg }}"
git branch -M main
git remote add origin https://${{ secrets.PAT_TOKEN }}@github.com/IsSlashy/p01-mobile.git
git push -f origin main
echo "✓ p01-mobile synced"
- name: Sync p01-extension
if: steps.changes.outputs.extension == 'true' || github.event_name == 'workflow_dispatch'
run: |
echo "Syncing p01-extension..."
cd apps/extension
rm -rf .git node_modules dist 2>/dev/null || true
git init
git add -A
git commit -m "${{ steps.msg.outputs.msg }}"
git branch -M main
git remote add origin https://${{ secrets.PAT_TOKEN }}@github.com/IsSlashy/p01-extension.git
git push -f origin main
echo "✓ p01-extension synced"
- name: Sync p01-sdk
if: steps.changes.outputs.sdk == 'true' || github.event_name == 'workflow_dispatch'
run: |
echo "Syncing p01-sdk..."
mkdir -p /tmp/p01-sdk/core
# Copy p01-js as main SDK
cp -r packages/p01-js/* /tmp/p01-sdk/ 2>/dev/null || true
# Copy specter-sdk as core
cp -r packages/specter-sdk/* /tmp/p01-sdk/core/ 2>/dev/null || true
# Clean up
rm -rf /tmp/p01-sdk/node_modules /tmp/p01-sdk/core/node_modules /tmp/p01-sdk/.git 2>/dev/null || true
cd /tmp/p01-sdk
git init
git add -A
git commit -m "${{ steps.msg.outputs.msg }}"
git branch -M main
git remote add origin https://${{ secrets.PAT_TOKEN }}@github.com/IsSlashy/p01-sdk.git
git push -f origin main
echo "✓ p01-sdk synced"
- name: Summary
run: |
echo "## Sync Summary" >> $GITHUB_STEP_SUMMARY
echo "| Repo | Status |" >> $GITHUB_STEP_SUMMARY
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| p01-web | ${{ steps.changes.outputs.web == 'true' && '✅ Synced' || '⏭️ Skipped' }} |" >> $GITHUB_STEP_SUMMARY
echo "| p01-mobile | ${{ steps.changes.outputs.mobile == 'true' && '✅ Synced' || '⏭️ Skipped' }} |" >> $GITHUB_STEP_SUMMARY
echo "| p01-extension | ${{ steps.changes.outputs.extension == 'true' && '✅ Synced' || '⏭️ Skipped' }} |" >> $GITHUB_STEP_SUMMARY
echo "| p01-sdk | ${{ steps.changes.outputs.sdk == 'true' && '✅ Synced' || '⏭️ Skipped' }} |" >> $GITHUB_STEP_SUMMARY