Skip to content

Get the infrastructure up #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/CleanPreview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# from https://github.com/CliMA/ClimaTimeSteppers.jl
name: Doc Preview Cleanup

on:
pull_request:
types: [closed]

jobs:
doc-preview-cleanup:
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v2
with:
ref: gh-pages
- name: Delete preview and history + push changes
run: |
if [ -d "previews/PR$PRNUM" ]; then
git config user.name "Documenter.jl"
git config user.email "documenter@juliadocs.github.io"
git rm -rf "previews/PR$PRNUM"
git commit -m "delete preview"
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
git push --force origin gh-pages-new:gh-pages
fi
env:
PRNUM: ${{ github.event.number }}
14 changes: 14 additions & 0 deletions .github/workflows/Comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: PR Comment # Write a comment in the PR with a link to the preview of the given website
on:
pull_request:
types: [opened, reopened]
jobs:
pr_comment:
runs-on: ubuntu-latest
steps:
- name: Create PR comment
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
uses: thollander/actions-comment-pull-request@71efef56b184328c7ef1f213577c3a90edaa4aff
with:
message: 'Once the build has completed, you can preview your PR at this URL: https://fluxml.ai/previews/PR${{ github.event.number }}/'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 changes: 24 additions & 6 deletions .github/Deploy.yml → .github/workflows/Deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
branches:
- master
- main
pull_request:

jobs:
build-and-deploy:
runs-on: ubuntu-latest
Expand All @@ -14,7 +16,7 @@ jobs:
persist-credentials: false
# NOTE: Python is necessary for the pre-rendering (minification) step
- name: Install python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.8'
# NOTE: Here you can install dependencies such as matplotlib if you use
Expand All @@ -36,9 +38,25 @@ jobs:
using Franklin;
Pkg.activate("."); Pkg.instantiate();
optimize()'
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
- name: Fix URLs for PR preview deployment (pull request previews)
if: github.event_name == 'pull_request'
run: |
echo "PREVIEW_FRANKLIN_WEBSITE_URL=https://fluxml.ai/previews/PR${{ github.event.number }}/" >> $GITHUB_ENV
echo "PREVIEW_FRANKLIN_PREPATH=previews/PR${{ github.event.number }}" >> $GITHUB_ENV
- name: Deploy (preview)
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
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: __site
branch: gh-pages # The branch where the PRs previews are stored
folder: __site
token: ${{ secrets.GITHUB_TOKEN }}
target-folder: "previews/PR${{ github.event.number }}" # The website preview is going to be stored in a subfolder
- name: Deploy (main)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages # Replace here the branch where your website is deployed
folder: __site
clean-exclude: |
previews/*
4 changes: 2 additions & 2 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ website_twitter_url = "https://twitter.com/FluxML?ref_src=twsrc%5Etfw"

ignore = ["_old/", "CONTRIBUTING.md"]

# Adjust when moving to prod (note: if fluxml.ai, then no need for prepath)
prepath = "fluxml-franklin"
prepath = get(ENV, "PREVIEW_FRANKLIN_PREPATH", ".")
website_url = get(ENV, "PREVIEW_FRANKLIN_WEBSITE_URL", "fluxml.ai")
+++

\newcommand{\totop}{~~~<p><a href="#top">⇧ back to top</a></p>~~~}