update deploy.yml #6
Workflow file for this run
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 Static Site | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Create clean deploy folder (exclude versions/, .github/) | |
| run: | | |
| mkdir deploy | |
| rsync -av --exclude=versions --exclude=.github --exclude=.git ./ ./deploy/ | |
| - name: Copy to versions/ on tag push | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| TAG_NAME="${GITHUB_REF##refs/tags/}" | |
| mkdir -p "versions/JobPower_${TAG_NAME}" | |
| rsync -av --exclude=versions --exclude=.github --exclude=.git ./ "versions/JobPower_${TAG_NAME}/" | |
| - name: Commit version folder | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| TAG_NAME="${GITHUB_REF##refs/tags/}" | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| git add "versions/JobPower_${TAG_NAME}" | |
| git commit -m "Add JobPower version ${TAG_NAME}" | |
| git push origin HEAD:main | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_branch: gh-pages | |
| publish_dir: ./deploy |