Skip to content

Commit e05cf18

Browse files
committed
Set up new-style GitHub pages deployment
This adds a GitHub actions workflow to build the site (on every push to main and every PR) and deploy that build (only on pushes to main) to GitHub pages. It also includes a huge mess of URL formatting fixes to make alternative deployment locations work correctly.
1 parent 87e55a6 commit e05cf18

19 files changed

Lines changed: 190 additions & 130 deletions

.github/workflows/deploy.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Deploy to GH Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
jobs:
20+
build:
21+
name: Build
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v5
26+
27+
- name: Set up Ruby
28+
uses: ruby/setup-ruby@v1
29+
with:
30+
bundler-cache: true
31+
rubygems: latest
32+
33+
- name: Build with Jekyll
34+
run: bundle exec jekyll build
35+
36+
- name: Upload artifact
37+
uses: actions/upload-pages-artifact@v3
38+
with:
39+
path: '_site'
40+
41+
deploy:
42+
name: Deploy
43+
if: github.ref == 'refs/heads/main'
44+
environment:
45+
name: github-pages
46+
url: ${{ steps.deployment.outputs.page_url }}
47+
runs-on: ubuntu-latest
48+
needs:
49+
- build
50+
steps:
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.8

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
source "https://rubygems.org"
2-
ruby '~> 2.3'
2+
ruby '~> 2.7'
33

44
# Hello! This is where you manage which Jekyll version is used to run.
55
# When you want to use a different version, change it below, save the

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ DEPENDENCIES
7070
tzinfo-data
7171

7272
RUBY VERSION
73-
ruby 2.3.3p222
73+
ruby 2.7.8p225
7474

7575
BUNDLED WITH
7676
1.17.2

_includes/footer.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<div id="footer_edg">
66
<small class="mt2 pr3"><a class="black" href="https://envirodatagov.org">The Environmental Data &amp; Governance Initiative, 2017</a></small>
77
<div>
8-
<a href="https://twitter.com/EnviroDGI" target="_blank" rel="noopener"><img class="social" src="/assets/tw.svg"/></a>
9-
<a href="https://www.facebook.com/EnviroDGI/" target="_blank" rel="noopener"><img class="social" src="/assets/fb.svg"/></a>
10-
<a href="https://www.instagram.com/envirodgi/" target="_blank" rel="noopener"><img class="social" src="/assets/ig.png"/></a>
8+
<a href="https://twitter.com/EnviroDGI" target="_blank" rel="noopener"><img class="social" src="{{ "/assets/tw.svg" | relative_url }}"/></a>
9+
<a href="https://www.facebook.com/EnviroDGI/" target="_blank" rel="noopener"><img class="social" src="{{ "/assets/fb.svg" | relative_url }}"/></a>
10+
<a href="https://www.instagram.com/envirodgi/" target="_blank" rel="noopener"><img class="social" src="{{ "/assets/ig.png" | relative_url }}"/></a>
1111
</div>
1212
</div>
1313
</footer>

_includes/head.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<title>{{ site.title }}{% if page.title %}: {{ page.title | strip | strip_html }}{% endif %} | {{ site.author }}</title>
77
<meta name="description" content="{{ site.description }}">
88
<link rel="canonical" href="{{ site.production_url }}{{ page.url | replace:'index.html',''}}">
9-
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="/feed.xml">
9+
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ "/feed.xml" | relative_url }}">
1010

11-
<link rel="stylesheet" href="/assets/{% if page.url == '/' %}main.css{% else %}post.css{% endif %}">
12-
<link rel="stylesheet" href="/assets/tachyons.min.css"/>
11+
<link rel="stylesheet" href="{{ site.baseurl }}/assets/{% if page.url == '/' %}main.css{% else %}post.css{% endif %}">
12+
<link rel="stylesheet" href="{{ "/assets/tachyons.min.css" | relative_url }}"/>
1313
<link href="https://fonts.googleapis.com/css?family=Open+Sans:600,700|Open+Sans+Condensed:300,700|Source+Sans+Pro:300,400,400i,600" rel="stylesheet">
14-
<link rel="shortcut icon" href="/assets/favicon.ico" type="image/x-icon">
15-
<link rel="icon" href="/assets/favicon.ico" type="image/x-icon">
14+
<link rel="shortcut icon" href="{{ "/assets/favicon.ico" | relative_url }}" type="image/x-icon">
15+
<link rel="icon" href="{{ "/assets/favicon.ico" | relative_url }}" type="image/x-icon">
1616

1717
<!-- Open Graph -->
1818
<meta property="og:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}"/>
@@ -34,10 +34,10 @@
3434
src="https://code.jquery.com/jquery-3.2.1.min.js"
3535
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
3636
crossorigin="anonymous"></script>
37-
<script src="/jquery.sticky.js"></script>
37+
<script src="{{ "/jquery.sticky.js" | relative_url }}"></script>
3838
<script
3939
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC-NT3us7uJrevRXy3HWOrv6mQmahMglLk">
4040
</script>
41-
<script src="/assets/scripts.js"></script>
41+
<script src="{{ "/assets/scripts.js" | relative_url }}"></script>
4242
{% endif %}
4343
</head>

_includes/nav.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div id="nav" class="w-100 pv1">
2-
<a href="/index.html" title="Home" class="">
3-
<img id="nav-logo" src="/assets/edgi-logo-b.png">
2+
<a href="{{ "/index.html" | relative_url }}" title="Home" class="">
3+
<img id="nav-logo" src="{{ "/assets/edgi-logo-b.png" | relative_url }}">
44
</a>
55
<div id="nav-txt" class="di"><h3 class="f5 ttu tl mb0 di">Part {{ page.section }}</h3><h3 class="f5 fw3 ttu tl mb0 di"> | {{ page.title }}</h3></div>
66
</div>

assets/main.css

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
---
3+
14
/**
25
* Reset some basic elements
36
*/
@@ -133,7 +136,7 @@ section {
133136
height: 80vh;
134137
min-height: 400px;
135138
width: 90vw;
136-
background: url("/assets/flag-joe-raedle.jpg");
139+
background: url("{{ "/assets/flag-joe-raedle.jpg" | relative_url }}");
137140
background-size: cover;
138141
background-position: top;
139142
background-repeat: no-repeat;
@@ -193,7 +196,7 @@ section {
193196
line-height: 1.4em;
194197
}
195198
#down {
196-
background: url("/assets/down.svg");
199+
background: url("{{ "/assets/down.svg" | relative_url }}");
197200
box-sizing: border-box;
198201
position: relative;
199202
margin: auto;
@@ -206,17 +209,17 @@ section {
206209
bottom: 3vh;
207210
}
208211
#ch1bg {
209-
background: url("/assets/part1-cover-image.jpg");
212+
background: url("{{ "/assets/part1-cover-image.jpg" | relative_url }}");
210213
background-position: top;
211214
background-size: cover;
212215
}
213216
#ch2bg {
214-
background: url("/assets/part2-cover-image.jpg");
217+
background: url("{{ "/assets/part2-cover-image.jpg" | relative_url }}");
215218
background-position: bottom;
216219
background-size: cover;
217220
}
218221
#ch3bg {
219-
background: url("/assets/part3-cover-image.jpg");
222+
background: url("{{ "/assets/part3-cover-image.jpg" | relative_url }}");
220223
background-position: left;
221224
background-size: cover;
222225
}
@@ -305,7 +308,7 @@ div.readch-app {
305308
padding: 0;
306309
}
307310
#right {
308-
background: url("/assets/right.svg");
311+
background: url("{{ "/assets/right.svg" | relative_url }}");
309312
height: 40px;
310313
width: 32px;
311314
background-size:cover;
@@ -316,15 +319,15 @@ div.readch-app {
316319
z-index: 4;
317320
}
318321
#righta {
319-
background: url("/assets/right.svg");
322+
background: url("{{ "/assets/right.svg" | relative_url }}");
320323
height: 1.5em;
321324
width: 1em;
322325
background-size:contain;
323326
background-repeat: no-repeat;
324327
background-position: center;
325328
}
326329
#right2b {
327-
background: url("/assets/right.svg");
330+
background: url("{{ "/assets/right.svg" | relative_url }}");
328331
height: 40px;
329332
width: 32px;
330333
background-size:cover;

assets/post.css

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
---
3+
14
/**
25
* Reset some basic elements
36
*/
@@ -201,25 +204,25 @@ header {
201204
margin: 0;
202205
}
203206
#bg1 {
204-
background: url("/assets/part1-cover-image.jpg");
207+
background: url("{{ "/assets/part1-cover-image.jpg" | relative_url }}");
205208
background-position: bottom;
206209
background-size: cover;
207210
background-repeat: no-repeat;
208211
}
209212
#bg2 {
210-
background: url("/assets/part2-cover-image.jpg");
213+
background: url("{{ "/assets/part2-cover-image.jpg" | relative_url }}");
211214
background-position: bottom;
212215
background-size: cover;
213216
background-repeat: no-repeat;
214217
}
215218
#bg2a {
216-
background: url("/assets/mustafa.jpg");
219+
background: url("{{ "/assets/mustafa.jpg" | relative_url }}");
217220
background-position: bottom;
218221
background-size: cover;
219222
background-repeat: no-repeat;
220223
}
221224
#bg3 {
222-
background: url("/assets/part3-cover-image.jpg");
225+
background: url("{{ "/assets/part3-cover-image.jpg" | relative_url }}");
223226
background-position: left;
224227
background-size: cover;
225228
background-repeat: no-repeat;
@@ -456,10 +459,10 @@ figcaption.wide-fig {
456459
}
457460
458461
#btm_throw_left_img {
459-
background: url("/assets/ch1-cover.jpg");
462+
background: url("{{ "/assets/ch1-cover.jpg" | relative_url }}");
460463
}
461464
#btm_throw_right_img{
462-
background: url("/assets/ali.jpg");
465+
background: url("{{ "/assets/ali.jpg" | relative_url }}");
463466
}
464467
#btm_throw_left_img, #btm_throw_right_img{
465468
box-sizing: border-box;
@@ -484,7 +487,7 @@ figcaption.wide-fig {
484487
text-decoration: underline;
485488
}
486489
#righta {
487-
background: url("/assets/right.svg");
490+
background: url("{{ "/assets/right.svg" | relative_url }}");
488491
height: 1.5em;
489492
width: 1em;
490493
background-size:contain;

changing-digital-climate-data.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
---
1515
<body class="bg-white">
1616
<div>
17-
<a id="logo" href="/index.html" title="Home" class=""><img alt="edgi-logo" src="/assets/edgi-logo-b.png" style="width:5vh;min-width:35px; height:auto;"></a>
17+
<a id="logo" href="{{ "/index.html" | relative_url }}" title="Home" class=""><img alt="edgi-logo" src="{{ "/assets/edgi-logo-b.png" | relative_url }}" style="width:5vh;min-width:35px; height:auto;"></a>
1818
</div>
1919
<header>
2020
<div id="bg3" class="chbg"></div>
@@ -30,7 +30,7 @@ <h2 class="f3 fw3 ttu tl pv2">{{ page.subtitle }}</h2>
3030
</div>
3131
</header>
3232
<div id="nav" class="w-100 pv1">
33-
<a href="/index.html" title="Home" class=""> <img id="nav-logo" src="/assets/edgi-logo-b.png"> </a>
33+
<a href="{{ "/index.html" | relative_url }}" title="Home" class=""> <img id="nav-logo" src="{{ "/assets/edgi-logo-b.png" | relative_url }}"> </a>
3434
<div id="nav-txt" class="di">
3535
<h3 class="f5 ttu tl mb0 di">Part 3</h3>
3636
<h3 class="f5 fw3 ttu tl mb0 di"> | {{ page.subtitle }}</h3>
@@ -40,7 +40,7 @@ <h3 class="f5 fw3 ttu tl mb0 di"> | {{ page.subtitle }}</h3>
4040
<div class="left-sidebar">
4141
<div class="back-to-article dib mh3 dn-ns dn-m dib-l">
4242
<div class="dib">
43-
<a href="/changing-digital-climate/" class="dib tc"> <img alt="top" src="/assets/back.png" class="" style="width:40px; margin-bottom:10px">
43+
<a href="{{ "/changing-digital-climate/" | relative_url }}" class="dib tc"> <img alt="top" src="{{ "/assets/back.png" | relative_url }}" class="" style="width:40px; margin-bottom:10px">
4444
<h3 class="f5 fw1 ttu">Back to Main Article</h3>
4545
</a>
4646
</div>
@@ -82,7 +82,7 @@ <h3 class="f5 fw1 ttu">Back to Main Article</h3>
8282
<p>Once a report is written, it is sent to a pool of journalists who have indicated their interest in receiving EDGI&rsquo;s website monitoring reports. We typically use a 48-hour embargo, allowing time for journalists to investigate report content, before reports are released publicly and journalists are permitted to publish about them. EDGI will sometimes work exclusively with journalists in cases where additional targeted investigation will produce more impactful reporting. Read EDGI&rsquo;s journalist policy
8383
<a href="https://docs.google.com/document/d/1EqY2rxItLZGC3n_nokQxzyeW_pTLP2cEKxYA8zMZO8Y/edit?usp%3Dsharing" target="_blank" rel="noopener">here</a>. </p>
8484
<div class="mt4">
85-
<p class="tc"><img alt="EDGI_Logo" src="/assets/edgi-logo-b.png" style="width: 30px; height: 30px;"></p>
85+
<p class="tc"><img alt="EDGI_Logo" src="{{ "/assets/edgi-logo-b.png" | relative_url }}" style="width: 30px; height: 30px;"></p>
8686
</div>
8787
</article>
8888
</main>

0 commit comments

Comments
 (0)