DEV Community

Cover image for ✉ Publish a Newsletter Directly from GitHub
Tomás Arias
Tomás Arias

Posted on

✉ Publish a Newsletter Directly from GitHub

Photo by Andrey Larin on Unsplash

Hey there 👋

For this Hackathon, my inspiration was GitHub's Release Radar, a place where I discovered a lot of interesting projects. I'm glad that it's back and I think it's an excellent resource for the community so I wanted to replicate that.

Using GitHub as a platform for this enables all of Git's features like version control, and more importantly, collaboration so anyone can curate what goes inside the newsletter through a Pull Request.

The GitHub Action uses SendGrid to send emails and keep track of all the subscribers and it's easily adaptable to launch your own newsletter!

Just create a repo, edit the README and follow the instructions:

My Workflow

Set up

You will need a SendGrid account and have completed these steps:

Add the generated API Key as a secret named SENDGRID_API_KEY in your repo settings.

It should look like this:

github com_KNawm_release-radar_settings_secrets

Once you create it, go to Contacts and open the list that was created automatically, to view it's ID open the list and check the URL, the ID will look like this: 81f44a3f-f1c2-4f47-a9a9-df79dd32d246. This will be your list_id.

Once you create it, you will be able to see it's ID, it will look like this: 22584. This will be your suppression_group_id.

Once you create it, click the 3 dots in the right of the Sender Management page and Edit the entry, check the URL and you will find a number that looks like this: 1057550. This will be your sender_id.

Inputs

All inputs are REQUIRED

Input Value Description
subject The subject line of the newsletter.
list_id The recipient List ID that will receive the newsletter.
suppression_group_id The ID of the Suppression Group to allow recipients to unsubscribe.
sender_id The ID of the verified Sender.

Example usage

name: Newsletter
on:
  workflow_dispatch:
    inputs:
      subject:
        description: 'Subject'
        required: true

jobs:
  newsletter:
    runs-on: ubuntu-latest
    name: Send newsletter
    steps:
    - name: Send newsletter
      uses: KNawm/newsletter-action@v1
      env:
        SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
      with:
        subject: ${{ github.event.inputs.subject }}
        list_id: '81f44a3f-f1c2-4f47-a9a9-df79dd32d246'
        suppression_group_id: 22584
        sender_id: 1057550

Demo: KNawm/release-radar

You need to trigger the workflow manually going to the Actions page of your repo and provide a subject line.

Once it's triggered it will send the content of your README to your list of recipients after 5 minutes.

If it's working you can enter here and you should see your email scheduled:

Submission Category:

Wacky Wildcards

Link to Code and Demo

GitHub logo KNawm / newsletter-action

📩 A GitHub Action for sending email formatted using Markdown.

newsletter-action

A GitHub Action for sending email formatted using Markdown

 

Set up

You will need a SendGrid account and have completed these steps:

Add the generated API Key as a secret named SENDGRID_API_KEY in your repo settings.

It should look like this:

github com_KNawm_release-radar_settings_secrets

Once you create it, go to Contacts and open the list that was created automatically, to view it's ID open the list and check the URL, the ID will look like this: 81f44a3f-f1c2-4f47-a9a9-df79dd32d246. This will be your list_id.

Once you create it, you will be able to see it's ID, it will look like this: 22584. This will be your suppression_group_id.

Once you create it, click the 3 dots in the right of the Sender Management page and Edit the entry, check the URL and you…

GitHub logo KNawm / release-radar

✉ Welcome to Release Radar Community, where we share projects curated and shipped by you, from world-changing technologies to weekend side projects.

Issue #1

Release Radar Community

Welcome to Release Radar Community, where we share projects curated and shipped by you, from world-changing technologies to weekend side projects.

GitHub CLI 1.0

GitHub CLI brings GitHub to your terminal. It reduces context switching, helps you focus, and enables you to more easily script and create your own workflows. With GitHub CLI 1.0, you can:

Run your entire GitHub workflow from the terminal, from issues through releases Call the GitHub API to script nearly any action, and set a custom alias for any command Connect to GitHub Enterprise Server in addition to GitHub.com

GitHub CLI 1.0

See you next month! 👋

Want to highlight a project? Open a PR
Curators this month: @KNawm

Top comments (1)

Collapse
 
filiptronicek profile image
Filip Troníček

Awesome idea!