Skip to content

Commit 6aeb385

Browse files
committed
Create newsletter scaffold
1 parent 8665ece commit 6aeb385

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed
File renamed without changes.

Diff for: .github/workflows/create-newsletter.yaml

+24-12
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,43 @@
1-
name: Create Newsletter Tracking Issue
1+
name: Create Newsletter
22
on:
33
schedule:
44
# Run on the 5th of every month at 12pm
55
- cron: "0 12 5 * *"
66
workflow_dispatch:
77
inputs: {}
88
permissions:
9-
contents: read
9+
contents: write
1010
issues: write
1111
jobs:
1212
create-newsletter:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v3
16-
- name: Set newsletter month
17-
run: echo "NEWSLETTER_MONTH=$(date +'%B')" >> $GITHUB_ENV
18-
- name: Set newsletter year
19-
run: echo "NEWSLETTER_YEAR=$(date +'%Y')" >> $GITHUB_ENV
20-
- name: Set newsletter deadline
21-
run: echo "NEWSLETTER_DEADLINE=$(date -d' 1 month ' '+%m.%Y')" >> $GITHUB_ENV
22-
- name: Set newsletter counter
23-
# take the amount of months since feb 2024 and add 50
24-
run: echo "NEWSLETTER_COUNTER=$(( ( ( $(date +'%Y') - 2024 ) * 12 + $(date +'%m') - 2 ) + 50 ))" >> $GITHUB_ENV
16+
- name: Set environment variables
17+
run: |
18+
echo "NEWSLETTER_MONTH=$(date +'%B')" >> $GITHUB_ENV
19+
echo "NEWSLETTER_YEAR=$(date +'%Y')" >> $GITHUB_ENV
20+
echo "NEWSLETTER_DEADLINE=$(date -d' 1 month ' '+%m.%Y')" >> $GITHUB_ENV
21+
# take the amount of months since feb 2024 and add 50
22+
echo "NEWSLETTER_COUNTER=$(( ( ( $(date +'%Y') - 2024 ) * 12 + $(date +'%m') - 2 ) + 50 ))" >> $GITHUB_ENV
23+
- name: Create newsletter scaffold
24+
run: |
25+
cp newsletter-template.md index.md
26+
sed -i "s/{{\s*NEWSLETTER_MONTH\s*}}/${{ env.NEWSLETTER_MONTH }}/g" index.md
27+
sed -i "s/{{\s*NEWSLETTER_YEAR\s*}}/${{ env.NEWSLETTER_YEAR }}/g" index.md
28+
sed -i "s/{{\s*NEWSLETTER_DEADLINE\s*}}/${{ env.NEWSLETTER_DEADLINE }}/g" index.md
29+
sed -i "s/{{\s*NEWSLETTER_COUNTER\s*}}/${{ env.NEWSLETTER_COUNTER }}/g" index.md
30+
# Create a dir in content/news with the counter with 3 digits as name
31+
mkdir -p content/news/$(printf "%03d" ${{ env.NEWSLETTER_COUNTER }})
32+
mv index.md content/news/$(printf "%03d" ${{ env.NEWSLETTER_COUNTER }})
33+
- name: Commit and push changes
34+
uses: EndBug/add-and-commit@v9
35+
with:
36+
message: "Create newsletter N${{ env.NEWSLETTER_COUNTER }} for ${{ env.NEWSLETTER_MONTH }} ${{ env.NEWSLETTER_YEAR }}"
2537
- name: Create tracking issue
2638
uses: JasonEtco/create-an-issue@v2
2739
env:
2840
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2941
with:
30-
filename: .github/newsletter-template.md
42+
filename: .github/newsletter-issue-template.md
3143

Diff for: newsletter-template.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
44
date = TODO
55
draft = true
@@ -9,7 +9,7 @@ draft = true
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)