Skip to content

Commit b641357

Browse files
committed
Set deployment to read SITEURL from env var, and explain deployment
Fixes #24.
1 parent f157b3b commit b641357

File tree

3 files changed

+57
-3
lines changed

3 files changed

+57
-3
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ jobs:
7979
git rm -rf ${{ env.OUTPUT_DIR }}
8080
cd website_2024/
8181
poetry run pelican ${{ env.INPUT_DIR }} -o ${{ env.OUTPUT_DIR }} -s ${{ env.PELICAN_CONF }}
82+
env:
83+
PLCN_SITEURL: ${{ vars.PLCN_SITEURL }}
8284

8385
# - name: Copy output to /docs
8486
# run: cp -r website_2024/output/* docs/

README.md

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,58 @@ You can also use `make devserver` for the HTML, and `npm run watch`
4040
for the styling -- these create watchers which update the output as
4141
you change the source files.
4242

43+
### Deployment
44+
45+
This repo is set up to deploy by Github Actions, to a GitHub Pages
46+
page. On the main repo, this gets deployed to
47+
https://hamakor.github.io/pycon-il-2024/ which is proxied from
48+
https://pycon.org.il/2024 . For this proxy to work well, the `SITEURL`
49+
setting points to that latter URL, rather than directly to the GitHub
50+
Pages (as usual with Pelican, in publishing we set the URLs to
51+
absolute and not relative).
52+
53+
The deploy operation is defined to trigger only on pushes to `main`.
54+
55+
The configuration settings are defined in
56+
`website_2024/pelicanconf.py` (for development) and `publishconf.py`
57+
(for "production").
58+
59+
Note that all explanations about Github here are valid at the time
60+
written, but Github may change their UI, or the way Pages and Actions
61+
work.
62+
63+
#### Alternate Deployment
64+
65+
The trivial case where you'd want an alternate deployment is when
66+
preparing changes in the website contents. Then, the only thing
67+
you really need to change is the `SITEURL`. The Github Action is
68+
set to read this from a Github Environment Variable `PLCN_SITEURL`,
69+
so you can just set that to your Github Pages site URL.
70+
71+
To set environment variables in Github, go to your repository
72+
settings, select "Secrets and variables" (under "Security"),
73+
and in the submenu choose "Actions".
74+
75+
In case you want your deployment to include the Speakers page, you
76+
also need to set two further variables: `PRETALX_API_TOKEN` and
77+
`PRETALX_EVENT_NAME`. They will fill the roles of `<api-token>` and
78+
`<event-slug>`, as described above.
79+
80+
Note that these are all defined as variables, not secrets. This is
81+
generally OK -- variables are only visible to people who have access
82+
to your repo settings, and the log of actions (where the token is
83+
printed) is also not publicly accessible.
84+
85+
In case you want your deployment to include other configuration
86+
changes which should not be part of the main deployment, you can put
87+
them in a file `alternateconf.py` next to `pelicanconf.py` and
88+
`publishconf.py`; definitions from `alternateconf.py` will override
89+
those from `publishconf.py` (which, in turn, inherit and override
90+
those in `pelicanconf.py`). The `alternateconf.py` file does not
91+
exist in the main branch, in order to make it easy to keep a separate
92+
branch in which it is added (and which you can then push to `main` on
93+
your own repo).
94+
4395
## Content
4496

4597
Pages are in `website_2024/content/pages`, and are written in
@@ -64,8 +116,6 @@ that. The original template was kept for reference as
64116
`index.html.orig`.
65117

66118
Other interesting files to look at:
67-
- The settings are defined in `website_2024/pelicanconf.py` (for
68-
development) and `publishconf.py` (for "production").
69119
- The sidebar is defined in
70120
`website_2024/themes/PyCon-Israel-Flex/templates/partial/sidebar.html`
71121
- The footer is in

website_2024/publishconf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
from pelicanconf import *
99

1010
# If your site is available via HTTPS, make sure SITEURL begins with https://
11-
SITEURL = "https://pycon.org.il/2024"
11+
# Note in SITEURL, we use `or` rather than a default, to handle
12+
# correctly the case that the env var is set to empty
13+
SITEURL = os.environ.get("PLCN_SITEURL") or "https://pycon.org.il/2024"
1214
RELATIVE_URLS = False
1315

1416
FEED_DOMAIN = SITEURL

0 commit comments

Comments
 (0)