Skip to content

Commit

Permalink
github: Update GitHub Pages deployment
Browse files Browse the repository at this point in the history
Use a two-stage build and deploy workflow. Also, avoid creating and
pushing to the git repo to publish: use artifacts instead.
  • Loading branch information
Patater committed Jun 29, 2024
1 parent e334acd commit 5f2136c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

jobs:
build-and-deploy:
build:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -43,13 +43,34 @@ jobs:
run: |
make -C manuscript manual.epub
- name: Deploy manuals
- name: Prepare GitHub Pages site
run: |
git config user.name "Jaeden Amero"
git config user.email "jaeden@patater.com"
touch .nojekyll
git add .nojekyll
mv ./manuscript/* ./
git add -f index.html manual.pdf manual.epub manual.html manual.css images
git commit -am "Deploy manual"
git push -f origin HEAD:refs/heads/gh-pages
cp -a manuscript/index.html _site/
cp -a manuscript/manual.pdf _site/
cp -a manuscript/manual.epub _site/
cp -a manuscript/manual.html _site/
cp -a manuscript/manual.css _site/
cp -a manuscript/images _site/
- name: Upload _site to GitHub
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: _site

deploy:
needs: build

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Empty file added _site/.nojekyll
Empty file.

0 comments on commit 5f2136c

Please sign in to comment.