Create static.yml #3
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
--- | |
# .github/workflows/build.yml | |
name: Build and Publish | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build_and_publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '>=1.20.0' | |
- name: Install and run minify | |
run: | | |
go install github.com/tdewolff/minify/v2/cmd/minify@latest | |
mkdir -p ./pages | |
minify -r -o ./pages/ ./*.html | |
cp ./LICENSE* ./pages/ | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
# If you're changing the branch from main, | |
# also change the `main` in `refs/heads/main` | |
# below accordingly. | |
if: github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./pages |