name: gitub pages

on:
  push:
    branches:
      - master

jobs:
  build-deploy:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@master

      - name: install
        run: yarn

      - name: build
        run: yarn build

      - name: deploy
        uses: peaceiris/actions-gh-pages@v2.5.0
        env:
          ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
          PUBLISH_BRANCH: gh-pages
          PUBLISH_DIR: ./dist

      - name: Sync to Gitee
        uses: wearerequired/git-mirror-action@master
        env:
          SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
        with:
          source-repo: "git@github.com:dream2023/f-render.git"
          destination-repo: "git@gitee.com:dream2023/f-render.git"

      - name: Build Gitee Pages
        uses: yanglbme/gitee-pages-action@master
        with:
          gitee-username: dream2023
          gitee-password: ${{ secrets.GITEE_PASSWORD }}
          gitee-repo: dream2023/f-render
