-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e2ea04f
Showing
8 changed files
with
296 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Deploy to Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Build job | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install python dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Install native dependencies | ||
run: sudo apt install imagemagick sass | ||
- name: Setup Pages | ||
id: pages | ||
uses: actions/configure-pages@v3 | ||
- name: Build Site | ||
run: python ./make.py | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: build/ | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.DS_Store | ||
.vscode | ||
/venv | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[ | ||
{ | ||
"date": "2024-01-04", | ||
"headline": "**Archiact** lets go of **‘a number’** of staff", | ||
"link": "https://twitter.com/ArchiactVR/status/1742955568967606290" | ||
}, | ||
{ | ||
"date": "2024-01-08", | ||
"affected": 1800, | ||
"headline": "**Unity Software** to cut roughly **1,800** jobs in ‘company reset’", | ||
"link": "https://www.reuters.com/technology/unity-software-cutting-25-staff-company-reset-continuation-2024-01-08/" | ||
}, | ||
{ | ||
"date": "2024-01-09", | ||
"affected": 500, | ||
"headline": "**Twitch** to cut **500** employees, about 35% of staff", | ||
"link": "https://www.bloomberg.com/news/articles/2024-01-09/amazon-s-twitch-to-cut-500-employees-about-35-of-staff" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import json | ||
import shutil | ||
import random | ||
import chevron | ||
import markdown | ||
import datetime | ||
|
||
|
||
RENDER_YEAR = 2024 | ||
DIR_OUTPUT = 'build/' | ||
DIR_STATIC = 'static/' | ||
|
||
MONTH_NAMES = [ | ||
'January', | ||
'February', | ||
'March', | ||
'April', | ||
'May', | ||
'June', | ||
'July', | ||
'August', | ||
'September', | ||
'October', | ||
'November', | ||
'December', | ||
] | ||
|
||
|
||
def maybe_mkdir(path): | ||
if not os.path.exists(path): | ||
os.mkdir(path) | ||
|
||
maybe_mkdir(DIR_OUTPUT) | ||
|
||
|
||
print("copying static assets...") | ||
staticAssets = [ | ||
'style.css', | ||
] | ||
for asset in staticAssets: | ||
shutil.copyfile( | ||
os.path.join(DIR_STATIC,asset), | ||
os.path.join(DIR_OUTPUT,asset)) | ||
|
||
|
||
with open('dataset.json') as f: | ||
dataset = json.load(f) | ||
|
||
months = [] | ||
for idx,name in enumerate(MONTH_NAMES): | ||
layoffs = [] | ||
for item in dataset: | ||
if item['date'].startswith(f"{RENDER_YEAR}-{(idx+1):02}-"): | ||
layoffs.append({ | ||
'text': markdown.markdown(item['headline'])[3:-4], # oh god, the hack to strip the <p> and </p> | ||
'link': item['link'] | ||
}) | ||
# add redacted lines for upcoming months | ||
now = datetime.datetime.now() | ||
current_month = now.month | ||
current_year = now.year | ||
if RENDER_YEAR >= current_year: | ||
if idx+1 == current_month: | ||
layoffs.append({'redacted':True}) | ||
if idx+1 > current_month: | ||
random.seed(idx+1) | ||
for x in range(0,random.randrange(2,4)): | ||
layoffs.append({'redacted':True}) | ||
if layoffs: | ||
months.append({ 'name': name, 'layoffs': layoffs }) | ||
|
||
|
||
total_this_year = sum([x.get('affected',0) for x in dataset if x['date'].startswith(f"{RENDER_YEAR}-")]) | ||
|
||
|
||
with open('site.mustache', 'r') as f: | ||
with open(os.path.join(DIR_OUTPUT,'index.html'), 'w') as fout: | ||
fout.write(chevron.render( | ||
template = f, | ||
data = { | ||
'dataset': dataset, | ||
'months': months, | ||
'total-this-year': f"{total_this_year:,}", | ||
'current-year': RENDER_YEAR | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
chevron==0.14.0 | ||
Markdown==3.5.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
python3 -m http.server -d build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<meta name="format-detection" content="telephone=no"> | ||
<link rel="stylesheet" href="style.css" /> | ||
</head> | ||
<body> | ||
|
||
<h2 class="page-title">How many people has the games industry laid off in {{current-year}}?</h2> | ||
|
||
<h2 class="more-than">more than</h2> | ||
<h1 class="year-total">{{total-this-year}}</h1> | ||
|
||
<div class="months"> | ||
{{#months}} | ||
<h3 class="month">{{name}}</h3> | ||
<ul class="layoffs"> | ||
{{#layoffs}} | ||
{{#redacted}} | ||
<li class="layoff redacted"></li> | ||
{{/redacted}} | ||
{{^redacted}} | ||
<li class="layoff"> | ||
{{{text}}} <sup><a href="{{link}}" class="source">[source]</a></sup> | ||
</li> | ||
{{/redacted}} | ||
{{/layoffs}} | ||
</ul> | ||
{{/months}} | ||
</div> | ||
|
||
<footer> | ||
Maintained, begrudgingly, by <a href="https://moonbase.lgbt/">Luna</a>.<br> | ||
<br> | ||
Heavily inspired by Rami Ismail’s <a href="https://is2020over.com/">is2020over.com</a> | ||
</footer> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
body { | ||
font-family: | ||
-apple-system, | ||
BlinkMacSystemFont, | ||
"Segoe UI", | ||
Roboto, | ||
"Helvetica Neue", | ||
Arial, | ||
"Noto Sans", | ||
sans-serif; | ||
margin: 2em 1em; | ||
} | ||
|
||
h2.page-title { | ||
text-wrap: balance; | ||
text-align: center; | ||
font-size: 1.4em; | ||
} | ||
|
||
h2.more-than { | ||
font-size: calc(min(7em, 15vw)); | ||
|
||
text-align: center; | ||
margin: 0; | ||
font-weight: 400; | ||
line-height: 1; | ||
} | ||
|
||
h1.year-total { | ||
/* this will need to be updated when the number inevitably grows too wide for the screen */ | ||
font-size: calc(min(15em, 30vw)); | ||
|
||
text-align: center; | ||
margin-top: 0; | ||
margin-bottom: 0.2em; | ||
font-weight: 400; | ||
line-height: 1; | ||
} | ||
|
||
div.months { | ||
max-width: 700px; | ||
margin: 2rem auto; | ||
} | ||
|
||
ul.layoffs { | ||
padding-left: 2em; | ||
} | ||
|
||
li.layoff { | ||
margin: 0.7em auto; | ||
} | ||
|
||
li.redacted { | ||
background: #000; | ||
} | ||
|
||
sup { | ||
font-size: 0.5em; | ||
} | ||
|
||
a { | ||
font-weight: bold; | ||
text-decoration: none; | ||
color: #007bff; | ||
} | ||
|
||
footer { | ||
text-align: center; | ||
font-size: 0.7em; | ||
} | ||
|
||
/*@media (prefers-color-scheme: dark) { | ||
body { | ||
background-color: #000; | ||
color: #fff; | ||
} | ||
li.redacted { | ||
background: #fff; | ||
} | ||
}*/ |