Skip to content

Commit 7c7ea93

Browse files
authored
Add GitHub Action for newsletter creation (#1464)
* Add GitHub Action for newsletter tracking issue * Restore newsletter template * Create newsletter scaffold * Refactor issue template * Refactor issue action * Incorporate feedback * Add terminal newline * Set target date
1 parent 6d9db16 commit 7c7ea93

4 files changed

+213
-3
lines changed

.github/create_newsletter_scaffold.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
if [[ -z "${NEWSLETTER_MONTH}" ]]; then
6+
echo "NEWSLETTER_MONTH is not set. Exiting..."
7+
exit 1
8+
fi
9+
10+
if [[ -z "${NEWSLETTER_YEAR}" ]]; then
11+
echo "NEWSLETTER_YEAR is not set. Exiting..."
12+
exit 1
13+
fi
14+
15+
if [[ -z "${NEWSLETTER_DEADLINE}" ]]; then
16+
echo "NEWSLETTER_DEADLINE is not set. Exiting..."
17+
exit 1
18+
fi
19+
20+
if [[ -z "${NEWSLETTER_COUNTER}" ]]; then
21+
echo "NEWSLETTER_COUNTER is not set. Exiting..."
22+
exit 1
23+
fi
24+
25+
cp newsletter-template.md index.md
26+
sed -i "s/{{\s*NEWSLETTER_MONTH\s*}}/${NEWSLETTER_MONTH}/g" index.md
27+
sed -i "s/{{\s*NEWSLETTER_YEAR\s*}}/${NEWSLETTER_YEAR}/g" index.md
28+
sed -i "s/{{\s*NEWSLETTER_DEADLINE\s*}}/${NEWSLETTER_DEADLINE}/g" index.md
29+
sed -i "s/{{\s*NEWSLETTER_COUNTER\s*}}/${NEWSLETTER_COUNTER}/g" index.md
30+
# Create a dir in content/news with the counter with 3 digits as name
31+
destination="content/news/$(printf "%03d" ${NEWSLETTER_COUNTER})"
32+
mkdir -p $destination
33+
mv index.md $destination/index.md
34+
git status

.github/newsletter-issue-template.md

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
---
2+
title: "Newsletter {{ env.NEWSLETTER_COUNTER}}: {{ env.NEWSLETTER_MONTH }} {{ env.NEWSLETTER_YEAR }}"
3+
labels: coordination, help wanted
4+
assignees: janhohenheim
5+
---
6+
7+
###### tags: `newsletter`
8+
9+
**Editors:**
10+
11+
Another month has gone by, so it's time to put together the Rust Gamedev
12+
newsletter with {{ env.NEWSLETTER_MONTH }}'s news!
13+
14+
## Current Schedule
15+
16+
The deadline for all section PRs is the **03.{{ env.NEWSLETTER_DEADLINE }}**
17+
18+
We _may_ still accept PRs that are submitted later than this, as long as they're
19+
ready before the newsletter's release, but this isn't guaranteed.
20+
If you want your section to be included, don't leave it till the last minute!
21+
22+
## Current Structure & Status
23+
24+
Below is our current planned structure for the newsletter,
25+
and the status of each PR (which we'll try to keep updated).
26+
27+
This is **not** an exhaustive list - if you have your own project that you want
28+
to write about, just make a comment on this issue and open a PR!
29+
30+
### Game Updates
31+
32+
- TODO
33+
34+
### Learning Material Updates
35+
36+
- TODO
37+
38+
### Engine Updates
39+
40+
- TODO
41+
42+
### Tooling Updates
43+
44+
- TODO
45+
46+
### Library Updates
47+
48+
- TODO
49+
50+
### Other News
51+
52+
- TODO
53+
54+
### Discussions
55+
56+
- TODO
57+
58+
## Publishing Steps
59+
60+
- [ ] Final review - by everyone
61+
- [ ] Publish - by @janhohenheim
62+
- [ ] Post on /r/rust, /r/rust_gamedev, /r/gamedev, URLO - by @janhohenheim
63+
- [ ] Pin thread on Twitter - by @AngelOnFira
64+
- [ ] Add comment links - by @AngelOnFira
65+
66+
## How to Contribute
67+
68+
If you want to help writing the newsletter:
69+
70+
- **Read [CONTRIBUTING.md](https://github.com/rust-gamedev/rust-gamedev.github.io/blob/source/CONTRIBUTING.md?rgh-link-date=2023-09-12T16%3A17%3A34Z).**
71+
- Choose one or more of the "🆓 **free**" sections listed below, and leave a
72+
comment letting us know you want to work on them.
73+
- The links in brackets (like `[1](#), [2](#), [3](#)`) are suggestions of
74+
links to include in the section. Feel free to add more!
75+
- The username listed next to the section (like `@janhohenheim?`) is a
76+
suggestion of who may want to pick up the work (usually the project's
77+
developer, or someone who has expressed interest in the past).
78+
- You are not obligated to write a section if you're tagged or your project
79+
is listed! You're welcome to ask someone else to write the section,
80+
or to ask for your project to be excluded from this month's post.
81+
- Extra sections not listed in the plan are welcomed -
82+
just leave a comment and open a PR!
83+
- Write a short overview in the newsletter's Markdown file,
84+
making sure to follow the style guidelines (see below).
85+
- Send a PR _to the `source` branch_ (example: [N15: A/B Street #336](https://github.com/rust-gamedev/rust-gamedev.github.io/pull/336)).
86+
- Mention this issue in your PR's description to link it all together.
87+
88+
## Style Guidelines
89+
90+
The full style guide is in [CONTRIBUTING.md](https://github.com/rust-gamedev/rust-gamedev.github.io/blob/source/CONTRIBUTING.md?rgh-link-date=2023-09-12T16%3A17%3A34Z),
91+
but here are the most important rules:
92+
93+
- Write in third-person perspective.
94+
- Each line must be 80 characters or less, for ease of reviewing/diffing.
95+
- Only one image per section is allowed.
96+
- The maximum size is 300kb for static images and 2.5mb for GIFs.
97+
- The image should come before the text, and must have alt text for accessibility.
98+
- Prefer static images to GIFs, to keep the page load times down.
99+
- Each section should be under 1000 characters, and under 6 paragraphs.
100+
- This only applies to the rendered text, not the markup.
101+
- Keep formatting minimal - no bold/italics/etc.
102+
- Avoid long/nested bullet point lists - no changelogs!
103+
104+
Please use these templates as a starting point:
105+
106+
**Games/apps/libraries:**
107+
108+
```md
109+
### [Game name]
110+
111+
![alt text](img)
112+
_optional image label_
113+
114+
[Game name] ([GitHub], [Discord], [Twitter]) by [@nickname]
115+
is... {short project description in one sentence}.
116+
117+
{An overview of the recent updates with links to more details}.
118+
119+
_Discussions: [/r/rust_gamedev](link), [Twitter](link), [etc](link)_
120+
121+
[Game name]: http://example.com
122+
```
123+
124+
**Articles/blog posts/videos/etc:**
125+
126+
```md
127+
### [Article name]
128+
129+
![alt text](img)
130+
_optional image label_
131+
132+
[@nickname] published an [article] about...
133+
{overview what the resource is about}.
134+
135+
_Discussions: [/r/rust_gamedev](link), [Twiter](link), [etc](link)_
136+
137+
[Article name]: http://example.com
138+
```
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Create Newsletter
2+
on:
3+
schedule:
4+
# Run on the 5th of every month at 12pm
5+
- cron: "0 12 5 * *"
6+
workflow_dispatch:
7+
inputs: {}
8+
permissions:
9+
contents: write
10+
issues: write
11+
jobs:
12+
create-newsletter:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
ref: source
18+
- name: Set environment variables
19+
run: |
20+
echo "NEWSLETTER_MONTH=$(date +'%B')" >> $GITHUB_ENV
21+
echo "NEWSLETTER_YEAR=$(date +'%Y')" >> $GITHUB_ENV
22+
echo "NEWSLETTER_DEADLINE=$(date -d' 1 month ' '+%m.%Y')" >> $GITHUB_ENV
23+
# take the amount of months since feb 2024 and add 50
24+
echo "NEWSLETTER_COUNTER=$(( ( ( $(date +'%Y') - 2024 ) * 12 + $(date +'%m') - 2 ) + 50 ))" >> $GITHUB_ENV
25+
- name: Create newsletter scaffold
26+
run: ./.github/create_newsletter_scaffold.sh
27+
- name: Commit and push changes
28+
uses: EndBug/add-and-commit@v9
29+
with:
30+
message: "Create newsletter N${{ env.NEWSLETTER_COUNTER }} for ${{ env.NEWSLETTER_MONTH }} ${{ env.NEWSLETTER_YEAR }}"
31+
push: "origin HEAD:source"
32+
- name: Create tracking issue
33+
uses: JasonEtco/create-an-issue@v2
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
with:
37+
filename: .github/newsletter-issue-template.md
38+

newsletter-template.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
+++
2-
title = "This Month in Rust GameDev #{TODO} - {TODO} {TODO}"
2+
title = "This Month in Rust GameDev #{{ NEWSLETTER_COUNTER }} - {{ NEWSLETTER_MONTH }} {{ NEWSLETTER_YEAR }}"
33
transparent = true
4-
date = TODO
4+
date = {{ NEWSLETTER_DEADLINE }}
55
draft = true
66
+++
77

88
<!-- no toc -->
99

1010
<!-- Check the post with markdownlint-->
1111

12-
Welcome to the {TODO}th issue of the Rust GameDev Workgroup's
12+
Welcome to the {{ NEWSLETTER_COUNTER }}th issue of the Rust GameDev Workgroup's
1313
monthly newsletter.
1414
[Rust] is a systems language pursuing the trifecta:
1515
safety, concurrency, and speed.

0 commit comments

Comments
 (0)