1- name : CI
1+ name : Deploy Website to GitHub Pages
22
33on :
44 push :
55 branches : main
6- pull_request :
7- branches : main
86
97# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
108permissions :
@@ -18,19 +16,19 @@ concurrency:
1816 cancel-in-progress : true
1917
2018jobs :
21- build-and-deploy :
19+ build :
2220 runs-on : ubuntu-latest
2321
2422 steps :
2523 - name : Checkout repository
26- uses : actions/checkout@v3
24+ uses : actions/checkout@v4
2725
2826 - name : Setup JupyterBook Cache
29- uses : actions/cache@v3
27+ uses : actions/cache@v4
3028 with :
3129 path : _build
3230 # NOTE: change key to "jupyterbook-DATE" to force rebuilding cache
33- key : jupyterbook-20230707
31+ key : jupyterbook-20240517
3432
3533 - name : Install Conda environment with Micromamba
3634 uses : mamba-org/setup-micromamba@v1
@@ -50,19 +48,31 @@ jobs:
5048 run : |
5149 if (test -a _build/html/reports/*log); then cat _build/html/reports/*log ; fi
5250
53- - name : Save Build
51+ - name : Save Build Folder
5452 if : always()
55- uses : actions/upload-artifact@v3
53+ uses : actions/upload-artifact@v4
5654 with :
5755 name : build
5856 path : _build/
5957
60- - name : Publish to GitHub Pages
61- if : github.ref == 'refs/heads/main'
62- uses : peaceiris/actions-gh-pages@v3
58+ - name : Upload Pages Artifact
59+ uses : actions/upload-pages-artifact@v3
6360 with :
64- github_token : ${{ secrets.GITHUB_TOKEN }}
65- publish_dir : _build/html
66- publish_branch : gh-pages
67- cname : tutorial.xarray.dev
68- enable_jekyll : false
61+ path : _build/html
62+
63+ # Publish Website to GitHub Pages if built successfully
64+ deploy :
65+ needs : build
66+ if : github.ref == 'refs/heads/main'
67+ runs-on : ubuntu-latest
68+ environment :
69+ name : github-pages
70+ url : ${{ steps.deployment.outputs.page_url }}
71+
72+ steps :
73+ - name : Setup Pages
74+ uses : actions/configure-pages@v5
75+
76+ - name : Deploy to GitHub Pages
77+ id : deployment
78+ uses : actions/deploy-pages@v4
0 commit comments