Skip to content

Commit

Permalink
Change deployment on SSP Cloud with new filesystem organization (#227)
Browse files Browse the repository at this point in the history
* fix ci problem

* Tweak

* extension

* prod

* Automated changes

* ajoute les headers

* Automated changes

* done

* Automated changes

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
linogaliana and github-actions[bot] committed May 25, 2022
1 parent 12965ba commit 4fc58e5
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/netlify-test.yaml
Expand Up @@ -27,13 +27,12 @@ jobs:
conda list
- name: Build to md
run: |
git diff --name-only origin/master origin/${GITHUB_HEAD_REF} >> diff
python build/tweak_render.py
quarto render --to hugo
mv content/course/manipulation/index.md content/course/manipulation/_index.md
mv content/course/visualisation/index.md content/course/visualisation/_index.md
mv content/course/modelisation/index.md content/course/modelisation/_index.md
#git diff --name-only origin/master origin/${GITHUB_HEAD_REF} >> diff.txt
#cat diff.txt
#Rscript -e 'source("./build/build_light.R")'
hugo mod graph
hugo -D --themesDir themes -t github.com
- name: Clean files with Python function
Expand Down Expand Up @@ -77,8 +76,6 @@ jobs:
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
# git config user.email github-actions@github.com
#git checkout ${BRANCHE_REF}
git status
find notebooks -type f -name "*.ipynb" | xargs git add
git commit -m "Automated changes";
Expand All @@ -103,6 +100,8 @@ jobs:
conda list
- name: Convert in ipynb with Jupytext
run: |
git diff --name-only origin/master origin/${GITHUB_HEAD_REF} >> diff
python build/tweak_render.py
quarto render content --to ipynb --execute
mkdir -p corrections
python build/move_files.py corrections
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/prod.yml
Expand Up @@ -45,12 +45,10 @@ jobs:
mkdir -p notebooks
python build/move_files.py notebooks
- name: Install npm
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
uses: actions/setup-node@v2
with:
node-version: '12'
- name: Deploy to Netlify
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
# NETLIFY_AUTH_TOKEN and NETLIFY_SITE_ID added in the repo's secrets
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
Expand Down
17 changes: 17 additions & 0 deletions build/tweak_render.py
@@ -0,0 +1,17 @@
import yaml

with open("_quarto.yml", "r") as stream:
config = yaml.load(stream, Loader=yaml.FullLoader)

with open('diff') as f:
lines = f.read().splitlines()

lines = [l for l in lines if l.endswith('.qmd') ]
lines += [f"content/course/{dir}/index.md" for dir in ["manipulation","visualisation","modelisation"]]

config['project']['render'] = lines

with open('_quarto.yml', 'w') as outfile:
yaml.dump(config, outfile, default_flow_style=False)

print("Done")
File renamed without changes.
4 changes: 2 additions & 2 deletions sspcloud/generate-doc.py
Expand Up @@ -83,12 +83,12 @@ def generate_block(name, abstract, authors, types, tags, category,
if section_md["chapters"]:
for chapter in section_md["chapters"]:
# Build chapter block if notebook exists
MD_PATH = os.path.join(PROJECT_DIR, "content", "course", section, f"{chapter}.Rmd")
MD_PATH = os.path.join(PROJECT_DIR, "content", "course", section, chapter, "index.qmd")

if os.path.isfile(MD_PATH):
name, abstract = extract_metadata_md(MD_PATH)

init_args = urllib.parse.quote(f"{section} {chapter}")
init_args = urllib.parse.quote(f"{section} {chapter}.ipynb")
launcher_url = LAUNCHER_TMPLT.format(init_args=init_args)

chapter_doc = generate_block(name=name,
Expand Down

0 comments on commit 4fc58e5

Please sign in to comment.