Skip to content

Commit

Permalink
Use actions/deploy-pages from main branch (#163)
Browse files Browse the repository at this point in the history
* try github pages setup

* update readme
  • Loading branch information
scottyhq authored May 7, 2024
1 parent 47f3e15 commit 3a6fd69
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
21 changes: 13 additions & 8 deletions .github/actions/buildresources/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,22 @@ runs:
run: |
if (test -a book/_build/html/reports/*log); then cat book/_build/html/reports/*log ; fi
- name: Publish to GitHub Pages
- name: Upload Pages HTML
if: inputs.publish-to-gh == 'true'
uses: peaceiris/actions-gh-pages@v3
uses: actions/upload-pages-artifact@v3
with:
github_token: ${{github.token}}
publish_dir: book/_build/html
publish_branch: gh-pages
enable_jekyll: false
cname: book-template.hackweek.io
path: _build/html

- name: Save Build
- name: Setup GitHub Pages
if: inputs.publish-to-gh == 'true'
uses: actions/configure-pages@v5

- name: Deploy to GitHub Pages
if: inputs.publish-to-gh == 'true'
id: deployment
uses: actions/deploy-pages@v4

- name: Upload Complete Build Folder
if: ${{ always() && inputs.jb-save == 'true'}}
uses: actions/upload-artifact@v4
with:
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Deploy

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

on:
push:
paths:
Expand All @@ -15,7 +21,9 @@ on:
jobs:
build-and-deploy:
runs-on: ubuntu-latest

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -34,4 +42,4 @@ jobs:
jb-cache: false
publish-to-gh: true
jb-save: true
token: ${{ secrets.GH_PAT }}
token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ You can use this template for your own event!

1. Click the "Use this template" button at the top of the repo
1. Select the account where you'd like to use the template.
1. **Be sure to select the checkbox to include all branches!** Otherwise your book will not be rendered automatically. You can remove all branches except for `main` and `gh-pages` from your new repo.
1. In your new repo, go to Settings > Pages to find the link to your JupyterBook. We recommend adding this link to the home page.
1. In your new repo, got to Settings --> Pages --> Source = GitHub Actions
1. Enter a Custom Domain if you have one, or use the default GitHub Pages URL
1. There are a few files you'll need to edit to customize content for your event:
* `cookiecutter.yaml`: customize your landing page content
* `book/_config.yml`: customize your JupyterBook content
Expand Down

0 comments on commit 3a6fd69

Please sign in to comment.