Skip to content

Commit 4afc3aa

Browse files
authored
Customize Video URLs (#2)
* Customize video urls * Pass repo secrets in production * Customization instructions
1 parent 64c6c03 commit 4afc3aa

7 files changed

Lines changed: 90 additions & 9 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ jobs:
5050

5151
# RENDER HTML AND PDF (see docs/_build)
5252
- name: Build the book
53+
env:
54+
# pass repo secrets as environment variables:
55+
EXERCISE_1_VIDEO_URL: ${{ secrets.EXERCISE_1_VIDEO_URL }}
56+
EXERCISE_2_VIDEO_URL: ${{ secrets.EXERCISE_2_VIDEO_URL }}
57+
EXERCISE_3_VIDEO_URL: ${{ secrets.EXERCISE_3_VIDEO_URL }}
58+
EXERCISE_4_VIDEO_URL: ${{ secrets.EXERCISE_4_VIDEO_URL }}
5359
run: |
5460
quarto render docs/
5561

docs/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ Install package dependencies:
3131
pip install -r docs/requirements.txt
3232
```
3333

34+
35+
## Customization
36+
37+
We are using environment variables to customize video URLs across different copies of the repository.
38+
39+
To set your own video URLs for local development, create a ".env" file in the "docs" folder, and place contents inside like the following:
40+
41+
```sh
42+
# this is the docs/.env" file...
43+
44+
EXERCISE_1_VIDEO_URL="https://vimeo.com/1078779616"
45+
EXERCISE_2_VIDEO_URL="https://vimeo.com/1078782830"
46+
EXERCISE_3_VIDEO_URL="https://vimeo.com/1078783956"
47+
EXERCISE_4_VIDEO_URL="https://vimeo.com/1078785045"
48+
```
49+
3450
## Initialization
3551

3652
FYI the following command was used to initialize the quarto config:
@@ -66,3 +82,5 @@ quarto render docs/ --verbose
6682
We are using the ["deploy.yml" workflow configuration file](/.github/workflows/deploy.yml) to deploy the site to GitHub Pages when new commits are pushed to the main branch.
6783

6884
In order for this to work, you first need to configure your GitHub Pages repo settings to publish via GitHub Actions.
85+
86+
If you would like to customize environment variables, you will also need to set them as repository secrets using the repository settings. The GitHub Actions workflow file will read repository secrets and pass them to the build as environment variables (no ".env" file necessary in production).

docs/exercises/1-version-control-workflow/index.qmd

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@ Gain familiarity with basic version control operations, including creating repos
66

77
## Walkthrough Video
88

9-
{{< video "https://vimeo.com/1078779616"
10-
title= "Version Control Workflow - Exercise Walkthrough" >}}
9+
```{python}
10+
#| echo: false
11+
#| output: asis
12+
13+
import os
14+
from dotenv import load_dotenv
15+
16+
load_dotenv()
17+
18+
VIDEO_URL = os.getenv("EXERCISE_1_VIDEO_URL", default="https://www.youtube.com/watch?v=UCcbvta2dp4")
19+
VIDEO_TITLE = "Version Control Workflow - Exercise Walkthrough"
20+
21+
video_markdown = "{{< video " + f"'{VIDEO_URL}'" + f" title= '{VIDEO_TITLE}' " + " >}}"
22+
print(video_markdown)
23+
```
24+
1125

1226
## Instructions
1327

docs/exercises/2-pull-request-workflow/index.qmd

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@ Adopt a Pull Request Workflow to collaborate with yourself (on independent proje
66

77
## Walkthrough Video
88

9-
{{< video "https://vimeo.com/1078782830"
10-
title="Pull Request Workflow - Exercise Walkthrough" >}}
9+
```{python}
10+
#| echo: false
11+
#| output: asis
12+
13+
import os
14+
from dotenv import load_dotenv
15+
16+
load_dotenv()
17+
18+
VIDEO_URL = os.getenv("EXERCISE_2_VIDEO_URL", default="https://www.youtube.com/watch?v=NTzUbULGc3o")
19+
VIDEO_TITLE = "Pull Request Workflow - Exercise Walkthrough"
20+
21+
video_markdown = "{{< video " + f"'{VIDEO_URL}'" + f" title= '{VIDEO_TITLE}' " + " >}}"
22+
print(video_markdown)
23+
```
24+
1125

1226
## Instructions
1327

docs/exercises/3-developer-team-workflow/index.qmd

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@ Adopt a Pull Request Workflow to collaborate with teammates, on team projects wh
66

77
## Walkthrough Video
88

9-
{{< video "https://vimeo.com/1078783956"
10-
title= "Developer Team Workflow - Exercise Walkthrough" >}}
9+
```{python}
10+
#| echo: false
11+
#| output: asis
12+
13+
import os
14+
from dotenv import load_dotenv
15+
16+
load_dotenv()
17+
18+
VIDEO_URL = os.getenv("EXERCISE_3_VIDEO_URL", default="https://www.youtube.com/watch?v=vsewcY7jwYA")
19+
VIDEO_TITLE = "Developer Team Workflow - Exercise Walkthrough"
20+
21+
video_markdown = "{{< video " + f"'{VIDEO_URL}'" + f" title= '{VIDEO_TITLE}' " + " >}}"
22+
print(video_markdown)
23+
```
24+
1125

1226
> Thanks to [Reed Uhlik](https://www.reeduhlik.com/) for collaborating on this video.
1327

docs/exercises/4-open-source-workflow/index.qmd

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,23 @@ Adopt and practice a Pull Request Workflow to collaborate with people you don't
66

77
## Walkthrough Video
88

9-
{{< video "https://vimeo.com/1078785045"
10-
title="Open Source Workflow - Exercise Walkthrough" >}}
9+
```{python}
10+
#| echo: false
11+
#| output: asis
12+
13+
import os
14+
from dotenv import load_dotenv
15+
16+
load_dotenv()
17+
18+
VIDEO_URL = os.getenv("EXERCISE_4_VIDEO_URL", default="https://www.youtube.com/watch?v=X0UQAVwzBZE")
19+
VIDEO_TITLE = "Open Source Workflow - Exercise Walkthrough"
20+
21+
video_markdown = "{{< video " + f"'{VIDEO_URL}'" + f" title= '{VIDEO_TITLE}' " + " >}}"
22+
print(video_markdown)
23+
```
24+
25+
1126

1227
> Thanks to [Reed Uhlik](https://www.reeduhlik.com/) for collaborating on this video.
1328

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jupyter
99
#jupyter-cache
1010

1111
# reading environment variables from the .env file:
12-
#python-dotenv
12+
python-dotenv
1313

1414
# packages required by any python code / notebooks:
1515
#numpy

0 commit comments

Comments
 (0)