Monthly Newsletter #4
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
name: Monthly Newsletter | |
on: | |
schedule: | |
- cron: '0 0 1 * *' # Runs at midnight on the first day of every month | |
workflow_dispatch: | |
inputs: | |
email: | |
description: 'Email address to send the newsletter to' | |
required: true | |
jobs: | |
generate-newsletter: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Cache npm dependencies | |
uses: actions/cache@v4 | |
with: | |
path: viewer/node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: cd viewer && npm install | |
- name: Generate newsletter | |
run: cd viewer && node scripts/newsletter.mjs | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
EMAIL_ADDRESS: ${{ secrets.EMAIL_ADDRESS }} | |
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }} | |
EMAIL_RECIPIENT: ${{ github.event.inputs.email }} | |
NODE_ENV: ${{ vars.NODE_ENV }} | |
EMAIL_STORE: true | |
- name: Upload newsletter artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: newsletter | |
path: viewer/newsletter.html |