Fix deployment to GitHub Pages on workflow dispatch (#7) #53
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: Publish to GitHub pages | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Composer cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.composer/cache/repo | |
key: composer-cache | |
- name: Prepare Composer auth | |
run: | | |
mkdir -p ~/.composer | |
cat > ~/.composer/auth.json <<EOL | |
{ | |
"github-oauth": { | |
"github.com": "${{ secrets.GH_PAT }}" | |
} | |
} | |
EOL | |
- name: Build the repository and site | |
run: ./build.sh | |
- name: Put the CNAME | |
if: success() | |
run: echo 'composer.talis.io' > dist/CNAME | |
- name: Deploy to GitHub Pages | |
if: ${{ success() && github.ref == 'refs/heads/main' }} | |
uses: crazy-max/ghaction-github-pages@v4 | |
with: | |
target_branch: gh-pages | |
build_dir: dist | |
jekyll: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |