-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (81 loc) · 3.29 KB
/
Copy pathsync-plugin.yml
File metadata and controls
94 lines (81 loc) · 3.29 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
name: Sync Plugin Distribution
on:
workflow_run:
workflows: ['CI']
types: [completed]
branches: [main]
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
# Only run if CI succeeded (or if manually triggered)
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout source repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
# Prevent GITHUB_TOKEN credential helper from overriding our deploy token
persist-credentials: false
- name: Display trigger information
run: |
echo "=== Sync Trigger Information ==="
echo "Event: ${{ github.event_name }}"
echo "Source SHA: ${{ github.event.workflow_run.head_sha || github.sha }}"
if [ "${{ github.event_name }}" = "workflow_run" ]; then
echo "CI Workflow Conclusion: ${{ github.event.workflow_run.conclusion }}"
fi
echo ""
- name: Clone distribution repository
env:
DEPLOY_TOKEN: ${{ secrets.PLUGIN_DIST_DEPLOY_TOKEN }}
run: |
echo "=== Cloning Distribution Repository ==="
git clone --branch main https://x-access-token:${DEPLOY_TOKEN}@github.com/lockstride/kickoff-plugin.git dist-repo
cd dist-repo
echo "Current branch: $(git branch --show-current)"
echo "Remote URL: $(git remote get-url origin | sed 's/x-access-token:[^@]*/x-access-token:***/')"
echo "Latest commit: $(git log --oneline -1)"
echo "Clone completed successfully"
echo ""
- name: Sync plugin contents
run: |
echo "=== Syncing Plugin Contents ==="
echo "Source: plugin/"
echo "Destination: dist-repo/"
rsync -av --checksum --delete --exclude='.git' --filter='protect /README.md' plugin/ dist-repo/
echo ""
- name: Show sync diff
working-directory: dist-repo
run: |
echo "=== Changes Detected ==="
git status --short
echo ""
echo "=== Detailed Status ==="
git status
echo ""
- name: Commit and push changes
working-directory: dist-repo
env:
SOURCE_SHA: ${{ github.event.workflow_run.head_sha || github.sha }}
run: |
echo "=== Checking for Changes ==="
if [ -z "$(git status --porcelain)" ]; then
echo "✓ No changes to sync - distribution repo is already up to date"
exit 0
fi
echo "✓ Changes detected, proceeding with commit"
echo ""
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
SHORT_SHA=$(echo "$SOURCE_SHA" | cut -c1-7)
COMMIT_MSG="Sync from lockstride/kickoff@$SHORT_SHA"
echo "=== Committing Changes ==="
echo "Commit message: $COMMIT_MSG"
git add -A
git commit -m "$COMMIT_MSG"
echo ""
echo "=== Pushing to Distribution Repository ==="
echo "Pushing to: lockstride/kickoff-plugin"
git push origin main
echo "✓ Successfully pushed changes to lockstride/kickoff-plugin"