|
| 1 | +name: Sync GitHub Pages |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + sync: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout current repository |
| 14 | + uses: actions/checkout@v4 |
| 15 | + with: |
| 16 | + path: archive-docs |
| 17 | + fetch-depth: 0 |
| 18 | + |
| 19 | + - name: Checkout GitHub Pages repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + repository: NG-ZORRO/ng-zorro.github.io |
| 23 | + token: ${{ secrets.ACCESS_TOKEN }} |
| 24 | + path: ng-zorro.github.io |
| 25 | + fetch-depth: 0 |
| 26 | + |
| 27 | + - name: Setup Git |
| 28 | + run: | |
| 29 | + git config --global user.name "ng-zorro-bot" |
| 30 | + git config --global user.email "ng-zorro-bot@users.noreply.github.com" |
| 31 | + |
| 32 | + - name: Replace issue-helper directory |
| 33 | + run: | |
| 34 | + echo "Removing old issue-helper directory from GitHub Pages..." |
| 35 | + rm -rf ng-zorro.github.io/issue-helper |
| 36 | + echo "Copying issue-helper directory from archive-docs..." |
| 37 | + cp -r archive-docs/issue-helper ng-zorro.github.io/issue-helper |
| 38 | + echo "issue-helper directory synced successfully" |
| 39 | + |
| 40 | + - name: Replace version directory |
| 41 | + run: | |
| 42 | + echo "Removing old version directory from GitHub Pages..." |
| 43 | + rm -rf ng-zorro.github.io/version |
| 44 | + echo "Copying version directory from archive-docs..." |
| 45 | + cp -r archive-docs/version ng-zorro.github.io/version |
| 46 | + echo "version directory synced successfully" |
| 47 | + |
| 48 | + - name: Commit and push changes to GitHub Pages |
| 49 | + run: | |
| 50 | + cd ng-zorro.github.io |
| 51 | + git add issue-helper/ version/ |
| 52 | + if git diff --staged --quiet; then |
| 53 | + echo "No changes to commit" |
| 54 | + else |
| 55 | + git commit -m "chore: sync issue-helper and version from archive-docs" |
| 56 | + git push origin master |
| 57 | + echo "Successfully synced to GitHub Pages" |
| 58 | + fi |
0 commit comments