name: Build website on: - push - pull_request jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: submodules: true fetch-depth: 0 - name: Setup Hugo uses: peaceiris/actions-hugo@v2 with: hugo-version: 'latest' extended: true - name: Build run: 'cd website && hugo --minify' - name: Set branch name id: branch run: echo "::set-output name=BRANCH_NAME::${GITHUB_REF##*/}" - name: Deploy if: steps.branch.outputs.BRANCH_NAME == 'master' && github.repository_owner == 'Rosettea' uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./website/public keep_files: true - name: Deploy if: steps.branch.outputs.BRANCH_NAME != 'master' && github.repository_owner == 'Rosettea' uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./website/public destination_dir: versions/${{ steps.branch.outputs.BRANCH_NAME }} keep_files: true