Skip to content

Commit

Permalink
feat: add scripts for auto creating dev night campaign (#2)
Browse files Browse the repository at this point in the history
* wip: move to src direcet and wip config

* wip: parse out event details

* wip: render email with data

* feat: add sync media script

* feat: finish out dev night campaign creation

* feat: update actions

* fix: handle different campaign statuses
  • Loading branch information
glitchedmob authored Aug 19, 2024
1 parent abcdd7b commit 15f6d4d
Show file tree
Hide file tree
Showing 31 changed files with 624 additions and 89 deletions.
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SGF_MEETUP_API_BASE_URL=https://sgf-meetup-api.opensgf.org
SGF_MEETUP_API_TOKEN=
LISTMONK_URL=https://newsletter.sgf.dev
LISTMONK_USERNAME=
LISTMONK_PASSWORD=
DEV_NIGHT_LIST_ID=
14 changes: 14 additions & 0 deletions .github/workflows/dev-night-campaign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Create Dev Night Email Campaign"
on:
workflow_dispatch:
jobs:
dev-night-campaign:
name: Dev Night Campaign
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- run: npm ci
- run: npm run dev-night-campaign
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- main
jobs:
lintk:
lint:
name: Lint PR
runs-on: ubuntu-latest
steps:
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/sync-media.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Sync Media"
on:
push:
branches:
- main
jobs:
sync-media:
name: Sync Media
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- run: npm ci
- run: npm run sync-media
37 changes: 34 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"description": "",
"type": "module",
"scripts": {
"dev": "email dev",
"export": "email export && tsx updateTrackingLinks.ts",
"dev": "email dev --dir src/emails",
"export": "email export --dir src/emails && tsx updateTrackingLinks.ts",
"dev-night-campaign": "tsx src/scripts/devNightCampaign",
"sync-media": "tsx src/scripts/syncMedia",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
Expand All @@ -22,6 +24,9 @@
"homepage": "https://github.com/cb0806151/react-email-test#readme",
"dependencies": {
"@react-email/components": "0.0.15",
"date-fns": "^3.6.0",
"date-fns-tz": "^3.1.3",
"dotenv": "^16.4.5",
"react-email": "2.1.0"
},
"devDependencies": {
Expand Down
32 changes: 32 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import 'dotenv/config';
import { _throw, parseNumber } from './util';

export const ASSET_BASE_URL = 'https://newsletter.sgf.dev/uploads';

export const SGF_DEVS_DISCORD_LINK = 'https://discord.com/invite/VNNJwJk';
export const SGF_DEVS_PROFILE_LINK = 'https://sgf.dev/register';
export const SGF_DEVS_TWITCH_LINK = 'https://www.twitch.tv/sgfdevs';
export const CENTRAL_TIMEZONE = 'America/Chicago';

export const SGF_MEETUP_API_BASE_URL =
process.env.SGF_MEETUP_API_BASE_URL ??
_throw('SGF_MEETUP_API_BASE_URL env var not set');

export const SGF_MEETUP_API_TOKEN =
process.env.SGF_MEETUP_API_TOKEN ??
_throw('SGF_MEETUP_API_TOKEN env var not set');

export const LISTMONK_URL =
process.env.LISTMONK_URL ?? _throw('LISTMONK_URL env var not set');

export const LISTMONK_USERNAME =
process.env.LISTMONK_USERNAME ??
_throw('LISTMONK_USERNAME env var not set');

export const LISTMONK_PASSWORD =
process.env.LISTMONK_PASSWORD ??
_throw('LISTMONK_PASSWORD env var not set');

export const DEV_NIGHT_LIST_ID =
parseNumber(process.env.DEV_NIGHT_LIST_ID) ??
_throw('DEV_NIGHT_LIST_ID env var not set or not a number');
Empty file added src/emails/index.tsx
Empty file.
Loading

0 comments on commit 15f6d4d

Please sign in to comment.