Skip to content

Commit 3415c29

Browse files
Merge pull request #354 from UBC-DSCI/main
Update public website
2 parents 4bf8838 + e1d0b34 commit 3415c29

File tree

11 files changed

+108
-47
lines changed

11 files changed

+108
-47
lines changed

.github/workflows/build_book.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/deploy_main_preview.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ jobs:
1515
packages: write
1616

1717
steps:
18+
- name: Get Actions user id
19+
id: get_uid
20+
run: |
21+
actions_user_id=`id -u $USER`
22+
echo $actions_user_id
23+
echo "uid=$actions_user_id" >> $GITHUB_OUTPUT
24+
1825
- name: checkout
1926
uses: actions/checkout@v2
2027
with:
@@ -24,6 +31,11 @@ jobs:
2431
run: |
2532
./build_html.sh
2633
34+
- name: Reset ownership of workspace after build
35+
uses: peter-murray/reset-workspace-ownership-action@v1
36+
with:
37+
user_id: ${{ steps.get_uid.outputs.uid }}
38+
2739
# Push the book's HTML to github-pages
2840
- name: GitHub Pages action
2941
uses: peaceiris/[email protected]

.github/workflows/deploy_pr_preview.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ jobs:
2323
checkName: "Rebuild docker image"
2424
ref: ${{ github.event.pull_request.head.sha }}
2525
timeoutSeconds: 60000
26-
26+
27+
- name: Get Actions user id
28+
id: get_uid
29+
run: |
30+
actions_user_id=`id -u $USER`
31+
echo $actions_user_id
32+
echo "uid=$actions_user_id" >> $GITHUB_OUTPUT
33+
2734
- name: Checkout the repo
2835
uses: actions/checkout@v2
2936
with:
@@ -34,6 +41,11 @@ jobs:
3441
run: |
3542
./build_html.sh
3643
44+
- name: Reset ownership of workspace after build
45+
uses: peter-murray/reset-workspace-ownership-action@v1
46+
with:
47+
user_id: ${{ steps.get_uid.outputs.uid }}
48+
3749
# Push the book's HTML to github-pages
3850
- name: GitHub Pages action
3951
uses: peaceiris/[email protected]
@@ -44,11 +56,35 @@ jobs:
4456
destination_dir: pull${{ github.event.number }}
4557
# force_orphan: true # once peaceiris updates to v4, change this to true and keep_files: true for the PR / main branch deploy previews
4658

59+
- name: Checkout the gh-pages branch
60+
uses: actions/checkout@v2
61+
with:
62+
fetch-depth: '0'
63+
ref: 'gh-pages'
64+
65+
- name: Run website diff
66+
run: |
67+
rustup update
68+
pip install --upgrade pip
69+
pip install website_diff
70+
rm -rf diff${{ github.event.number }}
71+
website_diff --old dev --new pull${{ github.event.number }} --diff diff${{ github.event.number }}
72+
73+
- name: GitHub Pages action to push diff
74+
uses: peaceiris/[email protected]
75+
with:
76+
github_token: ${{ secrets.GITHUB_TOKEN }}
77+
publish_dir: diff${{ github.event.number }}
78+
keep_files: true
79+
destination_dir: diff${{ github.event.number }}
80+
# force_orphan: true # once peaceiris updates to v4, change this to true and keep_files: true for the PR / main branch deploy previews
81+
4782
- name: Post URLS to PR thread
4883
uses: mshick/[email protected]
4984
with:
5085
message: |
5186
Hello! I've built a preview of your PR so that you can compare it to the current `main` branch.
5287
* PR deploy preview available [here](https://python.datasciencebook.ca/pull${{ github.event.number }}/index.html)
88+
* PR diff with `main` available [here](https://python.datasciencebook.ca/diff${{ github.event.number }}/index.html)
5389
* Current `main` deploy preview available [here](https://python.datasciencebook.ca/dev/index.html)
5490
* Public production build available [here](https://python.datasciencebook.ca)

.github/workflows/update_book.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Rebuild and deploy book to gh-pages branch
2+
on:
3+
push:
4+
branches:
5+
- production
6+
paths:
7+
- 'source/**'
8+
- 'build_html.sh'
9+
10+
jobs:
11+
deploy-book:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
packages: write
16+
17+
steps:
18+
- name: checkout gh-pages
19+
uses: actions/checkout@v2
20+
with:
21+
ref: 'gh-pages'
22+
23+
- name: Copy contents of dev/ to home folder
24+
run: |
25+
yes | cp -rf dev ${{ runner.home }}
26+
27+
# Push update website to dev/ and clean out old commits
28+
- name: Update website to contents of dev, remove all old commits and subpages
29+
uses: peaceiris/[email protected]
30+
with:
31+
github_token: ${{ secrets.GITHUB_TOKEN }}
32+
publish_dir: dev/
33+
force_orphan: true # this will clean up all previous PR previews / main branch preview
34+
cname: datasciencebook.ca
35+
36+
- name: copy dev/ website back in
37+
run: |
38+
yes | cp -rf ${{ runner.home }}/dev dev
39+
40+
- name: push the result to gh-pages
41+
uses: stefanzweifel/git-auto-commit-action@v5

build_html.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
chmod -R o+w source/
22
docker run --rm -v $(pwd):/home/jovyan ubcdsci/py-intro-to-ds:20231112004031dd2207 /bin/bash -c "jupyter-book build source"
3+

source/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Book settings
2-
title: "Data Science: A First Introduction (Python Edition)"
2+
title: "Data Science: A First Introduction with Python"
33
author: "Tiffany Timbers, Trevor Campbell, Melissa Lee, Joel Ostblom, and Lindsey Heagy"
44
copyright: "2022" # Copyright year to be placed in the footer
55
logo: "" # A path to the book logo

source/acknowledgements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ is reflected in the content of this book.
5050
## Acknowledgments for the Python Edition
5151

5252
We'd like to thank everyone that has contributed to the development of
53-
[*Data Science: A First Introduction (Python Edition)*](https://python.datasciencebook.ca).
53+
[*Data Science: A First Introduction with Python*](https://python.datasciencebook.ca).
5454
This is an open source Python translation of the original
5555
book, which focused on the R programming language. Both of these books are
5656
used to teach DSCI 100 at the University of British Columbia (UBC).

source/img/frontmatter/ds-a-first-intro-cover.jpg

100755100644
-34.2 KB
Loading

source/index.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,27 @@ kernelspec:
1717

1818
# Data Science
1919

20-
## *A First Introduction (Python Edition)*
20+
## *A First Introduction with Python*
2121

2222
*Tiffany Timbers, Trevor Campbell, Melissa Lee, Joel Ostblom, Lindsey Heagy*
2323

2424
### Welcome!
2525

26-
This is the [website](https://python.datasciencebook.ca) for *Data Science: A First Introduction (Python Edition)*.
26+
This is the [website](https://python.datasciencebook.ca) for *Data Science: A First Introduction with Python*.
2727
You can read the web version of the book on this site. Click a section in the table of contents
2828
on the left side of the page to navigate to it. If you are on a mobile device,
2929
you may need to open the table of contents first by clicking the menu button on
30-
the top left of the page.
30+
the top left of the page. You can purchase a PDF or print copy of the book on the [CRC Press website](https://www.routledge.com/Data-Science-A-First-Introduction-with-Python/Timbers-Campbell-Lee-Ostblom-Heagy/p/book/9781032572239) or on [Amazon](https://www.amazon.com/Data-Science-Introduction-Python-Chapman/dp/103257223X).
3131

32-
For the R version of the textbook, please visit https://datasciencebook.ca.
32+
For the R version of the textbook, please visit [https://datasciencebook.ca](https://datasciencebook.ca).
33+
34+
This book is listed in a number of open educational resource (OER) collections:
35+
36+
- [The University of British Columbia OER collection](https://oer.open.ubc.ca/data-science-a-first-introduction-python-version/)
37+
- [The OER Commons](https://oercommons.org/courses/data-science-a-first-introduction-with-python)
38+
- [MERLOT](https://merlot.org/merlot/viewMaterial.htm?id=773420157)
39+
40+
<img src="img/frontmatter/ds-a-first-intro-cover.jpg" width="400">
3341

3442
<img src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png">
3543

source/version-control.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,9 +1113,8 @@ and guidance that the worksheets provide will function as intended.
11131113
Now that you've picked up the basics of version control with Git and GitHub,
11141114
you can expand your knowledge through the resources listed below:
11151115

1116-
- GitHub's [guides website](https://guides.github.com/) and [YouTube
1117-
channel](https://www.youtube.com/githubguides) are great resources to take the next steps in
1118-
learning about Git and GitHub.
1116+
- GitHub's [guides website](https://docs.github.com/) is a great resource for
1117+
learning more about Git and GitHub.
11191118
- [Good enough practices in scientific
11201119
computing](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005510#sec014)
11211120
{cite:p}`wilson2014best` provides more advice on useful workflows and "good enough"

source/viz.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,7 @@ To fix this issue we can convert the `Expt` variable into a `nominal`
15491549
to the `Expt` variable. Adding the `:N` suffix ensures that `altair`
15501550
will treat a variable as a categorical variable, and
15511551
hence use a discrete color map in visualizations
1552-
([read more about data types in the altair documentation](https://altair-viz.github.io/user_guide/encoding.html#encoding-data-types)).
1552+
([read more about data types in the altair documentation](https://altair-viz.github.io/user_guide/encodings/index.html#encoding-data-types)).
15531553
We also add the `stack(False)` method on the `y` encoding so
15541554
that the bars are not stacked on top of each other,
15551555
but instead share the same baseline.

0 commit comments

Comments
 (0)