Skip to content

Commit 9a222f5

Browse files
committed
Add exercise D content
1 parent 1fc6bb6 commit 9a222f5

File tree

3 files changed

+128
-7
lines changed

3 files changed

+128
-7
lines changed
8.07 KB
Loading
71.8 KB
Loading

modules/05-sharing-and-publishing/index.md

Lines changed: 128 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -663,23 +663,144 @@ More information is available on the
663663
664664
## Hosting your website for free
665665
666-
### GitHub Pages
666+
There are many platforms for hosting a website (and PDF!) for free.
667+
We'll discuss some common options for open source projects.
667668
668-
TODO
669669
670+
### [GitHub Pages](https://docs.github.com/en/pages)
670671
671-
### ReadTheDocs
672+
GitHub Pages is, as it sounds, a GitHub-native solution for hosting web pages.
673+
It doesn't offer any advanced features, it only enables building a website from a GitHub
674+
repository.
672675
673-
TODO
676+
Pages are built using [GitHub Actions](https://github.com/features/actions).
674677
675678
676-
### 💪 Exercise D: Publish your paper and website to GitHub
679+
### [ReadTheDocs](https://about.readthedocs.com/)
680+
681+
ReadTheDocs is a community service for building and hosting webpages, most commonly
682+
software documentation.
683+
It provides advanced functionality like website previews for Pull Requests,
684+
multi-language builds, and multi-version builds.
685+
686+
It uses
687+
[its own unique file format](https://docs.readthedocs.com/platform/stable/config-file/v2.html)
688+
for specifying build processes.
689+
690+
691+
### 💪 Exercise D: Publish your paper and website to GitHub Pages
692+
693+
We're going to use GitHub Pages because it's more straightforward to configure.
694+
We recommend trying out ReadTheDocs if you need more advanced features!
695+
696+
697+
#### Update repository's GitHub Pages settings
698+
699+
* Open your repository URL in your browser
700+
* Click the "Settings" tab towards the top
701+
* Select "Pages" from the left menu
702+
* Change the "Source" dropdown to "GitHub Actions"
703+
704+
705+
#### Add GitHub Actions configuration file
706+
707+
Now that we've set up our repository to build our website using GitHub Actions,
708+
we need to define the build process in a configuration file.
709+
710+
MyST can do this automatically!
711+
In the terminal, from your `myst-exercise` project directory:
712+
713+
```bash
714+
myst init --gh-pages
715+
```
716+
717+
:::{important} 👀 You should notice...
718+
:class: simple
719+
:icon: false
720+
721+
This will create a new file (and its parent directories) at
722+
`.github/workflows/deploy.yml`.
723+
724+
**You may need to show hidden files so you can see the `.github` directory in the file
725+
browser.
726+
Select View > Show hidden files** from the menu.
727+
:::
728+
729+
730+
#### View the action results
731+
732+
After committing and pushing the GitHub Actions configuration file in the previous step,
733+
we can view the build that was triggered.
734+
735+
Visit your repository URL in GitHub.
736+
Click the "Actions" tab at the top.
737+
738+
:::{important} 👀 You should notice...
739+
:class: simple
740+
:icon: false
741+
742+
There is 1 workflow run, ideally with a green checkmark.
743+
:::
744+
745+
Click on the workflow run shown on this page.
746+
If it succeeded, you should see a node named "deploy" displayed on the page:
747+
748+
![](./github-actions-deploy-successful.jpg)
749+
750+
Click the link in the "deploy" node to view your built website.
751+
752+
:::{important} 👀 You should notice...
753+
:class: simple
754+
:icon: false
755+
756+
Your webpage displays on the public Internet!
757+
758+
At the top-right of this page, there's a "download" icon that looks a bit like this:
759+
760+
📥
761+
762+
When you click that icon, you're presented with an option to download your document as a
763+
PDF.
764+
765+
When you download your PDF, it looks exactly like the PDF you built manually earlier!
766+
:::
767+
768+
If your deploy failed, click the "deploy" node to view the error logs.
769+
See if you can solve the error on your own, and let an instructor know if you need help!
770+
771+
772+
#### Display your GitHub Pages URL on your repository homepage
773+
774+
GitHub offers a convenience feature to enable you to view your GitHub Pages URL on the
775+
homepage of your GitHub repo.
776+
777+
Visit the URL for your GitHub repo homepage.
778+
Towards the top-right, click the cog/gear icon (⚙️).
779+
780+
![](./github-repo-about-cog.jpg)
781+
782+
Finally, check the "Use your GitHub Pages website" checkbox, and then click "Save
783+
changes".
784+
785+
:::{important} 👀 You should notice...
786+
:class: simple
787+
:icon: false
788+
789+
Your GitHub Pages URL is visible near the cog/gear icon.
790+
Click the link to immediately open your website.
791+
:::
677792

678-
TODO
679793

680794
#### 🧠 What do we know now?
681795

682-
TODO
796+
* GitHub repositories need some initial setup in the web interface to publish a MyST
797+
site built in GitHub Actions.
798+
* MyST can do most of the work of configuring GitHub Actions deployments for us with a
799+
single command: `myst init --gh-pages`.
800+
* We can see deployment progress and results in the GitHub repository's "Actions" tab.
801+
* MyST will automatically build PDFs when building a website, and generate a download
802+
link on the relevant page.
803+
* A GitHub repository can display a convenient link to the related GitHub Pages website.
683804

684805

685806
## Getting a DOI

0 commit comments

Comments
 (0)