File tree Expand file tree Collapse file tree 4 files changed +67
-8
lines changed
Expand file tree Collapse file tree 4 files changed +67
-8
lines changed Original file line number Diff line number Diff line change 1+ # from https://github.com/CliMA/ClimaTimeSteppers.jl
2+ name : Doc Preview Cleanup
3+
4+ on :
5+ pull_request :
6+ types : [closed]
7+
8+ jobs :
9+ doc-preview-cleanup :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Checkout gh-pages branch
13+ uses : actions/checkout@v2
14+ with :
15+ ref : gh-pages
16+ - name : Delete preview and history + push changes
17+ run : |
18+ if [ -d "previews/PR$PRNUM" ]; then
19+ git config user.name "Documenter.jl"
20+ git config user.email "documenter@juliadocs.github.io"
21+ git rm -rf "previews/PR$PRNUM"
22+ git commit -m "delete preview"
23+ git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
24+ git push --force origin gh-pages-new:gh-pages
25+ fi
26+ env :
27+ PRNUM : ${{ github.event.number }}
Original file line number Diff line number Diff line change 1+ name : PR Comment # Write a comment in the PR with a link to the preview of the given website
2+ on :
3+ pull_request :
4+ types : [opened, reopened]
5+ jobs :
6+ pr_comment :
7+ runs-on : ubuntu-latest
8+ steps :
9+ - name : Create PR comment
10+ if : github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name # if this is a pull request build AND the pull request is NOT made from a fork
11+ uses : thollander/actions-comment-pull-request@71efef56b184328c7ef1f213577c3a90edaa4aff
12+ with :
13+ message : ' Once the build has completed, you can preview your PR at this URL: https://fluxml.ai/previews/PR${{ github.event.number }}/'
14+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 44 branches :
55 - master
66 - main
7+ pull_request :
8+
79jobs :
810 build-and-deploy :
911 runs-on : ubuntu-latest
1416 persist-credentials : false
1517 # NOTE: Python is necessary for the pre-rendering (minification) step
1618 - name : Install python
17- uses : actions/setup-python@v2
19+ uses : actions/setup-python@v4
1820 with :
1921 python-version : ' 3.8'
2022 # NOTE: Here you can install dependencies such as matplotlib if you use
3638 using Franklin;
3739 Pkg.activate("."); Pkg.instantiate();
3840 optimize()'
39- - name : Build and Deploy
40- uses : JamesIves/github-pages-deploy-action@releases/v3
41+ - name : Fix URLs for PR preview deployment (pull request previews)
42+ if : github.event_name == 'pull_request'
43+ run : |
44+ echo "PREVIEW_FRANKLIN_WEBSITE_URL=https://fluxml.ai/previews/PR${{ github.event.number }}/" >> $GITHUB_ENV
45+ echo "PREVIEW_FRANKLIN_PREPATH=previews/PR${{ github.event.number }}" >> $GITHUB_ENV
46+ - name : Deploy (preview)
47+ if : github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name # if this build is a PR build and the PR is NOT from a fork
48+ uses : JamesIves/github-pages-deploy-action@releases/v4
4149 with :
42- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43- BRANCH : gh-pages
44- FOLDER : __site
50+ branch : gh-pages # The branch where the PRs previews are stored
51+ folder : __site
52+ token : ${{ secrets.GITHUB_TOKEN }}
53+ target-folder : " previews/PR${{ github.event.number }}" # The website preview is going to be stored in a subfolder
54+ - name : Deploy (main)
55+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
56+ uses : JamesIves/github-pages-deploy-action@releases/v4
57+ with :
58+ token : ${{ secrets.GITHUB_TOKEN }}
59+ branch : gh-pages # Replace here the branch where your website is deployed
60+ folder : __site
61+ clean-exclude : |
62+ previews/*
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ website_twitter_url = "https://twitter.com/FluxML?ref_src=twsrc%5Etfw"
1414
1515ignore = [" _old/" , " CONTRIBUTING.md" ]
1616
17- # Adjust when moving to prod (note: if fluxml.ai, then no need for prepath )
18- prepath = " fluxml-franklin "
17+ prepath = g et(ENV, "PREVIEW_FRANKLIN_PREPATH", "." )
18+ website_url = g et(ENV, "PREVIEW_FRANKLIN_WEBSITE_URL", " fluxml.ai")
1919+++
2020
2121\newcommand{\totop}{~~~<p ><a href =" #top " >⇧ back to top</a ></p >~~~}
You can’t perform that action at this time.
0 commit comments