Mirror Website #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Mirror Website | |
on: | |
schedule: | |
- cron: '0 1 * * *' | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout MineBuilders/.github repository (source repository) | |
uses: actions/checkout@v2 | |
with: | |
repository: MineBuilders/.github | |
ref: gh-pages | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: temp-repo | |
- run: | | |
cp -r ./* ../backup/ | |
rm -rf ../backup/.git | |
- name: Checkout the current repository (destination repository) | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- run: | | |
find . -mindepth 1 -not -path './.git/*' -exec rm -rf {} + | |
cp -r ../backup/* . | |
- name: Commit and push to the main branch | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email 'actions@github.com' | |
git add . | |
git commit -m "Deploy website from MineBuilders/.github repository to main" | |
git push origin main |