CI: add deploy #1
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: Build and Check for Changes | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Build project | |
run: just build | |
- name: Check for changes | |
run: | | |
git status --porcelain | |
if [[ -n $(git status --porcelain) ]]; then | |
echo "Error: There are uncommitted changes after the build." | |
exit 1 | |
fi | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.ref == 'refs/heads/main' # to avoid deploying on PRs | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: . |