remove example page #88
This file contains hidden or 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: Deploy Hugo Site | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout dev branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: dev | |
| submodules: recursive | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Download Hugo 0.53 | |
| run: | | |
| wget -q https://github.com/gohugoio/hugo/releases/download/v0.53/hugo_0.53_Linux-64bit.tar.gz | |
| tar -xzf hugo_0.53_Linux-64bit.tar.gz | |
| chmod +x hugo | |
| ./hugo version | |
| - name: Build Hugo site | |
| run: ./hugo | |
| - name: Deploy to master branch | |
| run: | | |
| # Configure git | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| # Create worktree for master branch (separate directory, no conflicts) | |
| git worktree add /tmp/gh-pages master | |
| # Remove all files except .git | |
| cd /tmp/gh-pages | |
| find . -maxdepth 1 ! -name '.git' ! -name '.' ! -name '..' -exec rm -rf {} + | |
| # Copy built site | |
| cp -r $GITHUB_WORKSPACE/public/* . | |
| # Commit and push | |
| git add -A | |
| git commit -m "Deploy from dev - $(date '+%Y-%m-%d %H:%M:%S')" || echo "No changes" | |
| git push origin master | |
| # Cleanup | |
| cd $GITHUB_WORKSPACE | |
| git worktree remove --force /tmp/gh-pages |