Skip to main content

How to tweet your releases

Send a tweet to let people know when you release software on GitHub.

It's great to release software. And even better when people actually know about it!

One way to let people know about your new software releases is to tell them on Twitter. But we're software developers, not social media managers -- so that means we automate all the things.

With tweetrel, you can have GitHub send a tweet for you whenever you make a release.

Install

pip install tweetrel

How to use

First, you need to add your Twitter API details as GitHub secrets. You'll need to sign up for a Twitter API account if you don't already have one. Once you've signed up, Twitter will give you four keys: consumer_key, consumer_secret, access_token, and access_token_secret. Create a new secret called TWITTER, and paste those four keys in, with a space between each one.

If you need to send Tweets on behalf of a different user to the one attached to your login, you'll need to authenticate with Twitter as that user. Run tweetrel-auth in your terminal and follow the instructions, and it will give you the access_token and access_token_secret you need -- paste them (after a space) after your consumer_key and consumer_secret and that will let you send tweets as the user you authenticated as.

Next, in your terminal, cd to the root of your repo, and then run:

tweetrel-install

That will set tweetrel up for you to run automatically upon release. You'll see two folders added to your .github folder, containing the YAML workflow and python script. No additional setup is needed, other than pushing these to GitHub:

git add -A .github
git commit -am 'Add tweetrel`
git push

You can test this without actually making a release by going to your GitHub repo in your browser, clicking the Actions tab, then clicking on the tweet action, and clicking the run workflow button. That will use GitHub's example release payload for testing.

Once you've confirmed it's working, try making a release on GitHub, and check that you see the green tick in the Actions tab showing a successful run of the tweet action.

Customization

As you'll see, the default template is:

New #{repo} release: v{tag_name}. {html_url}\n\n{body}

You can customize that by setting the TWEETREL_TEMPLATE environment variable. For instance, add this (with suitable indentation) to the env: section of your workflow YAML file:

TWEETREL_TEMPLATE: |
  We are proud to announce the {tag_name} release of {repo}.

  For more, see: {html_url}. Here are the details:
  {body}

The | is the YAML character that indicates a multiline string. The sections in {...} are the Python formatting template variables that will be replaced by the details of your release. You don't need to include all of them if you don't want them.

Release files for tweetrel 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tweetrel 0.0.5
File Size Uploaded
tweetrel-0.0.5.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tweetrel 0.0.5
File Interpreter ABI Platform
tweetrel-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 18.4 kB

Release files / tweetrel-0.0.5.tar.gz

Download URL tweetrel-0.0.5.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
386d886400b10a2866fb783138a37eb4adf74d579bfc763c0ef0bc8efb10d882
BLAKE2b-256 checksum
How to use checksums
2c256b5e665c62c72eff56b499a1440629fb2bd9824b1feb0edcc82aadde53cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/49.6.0.post20200925 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.7

Release files / tweetrel-0.0.5-py3-none-any.whl

Download URL tweetrel-0.0.5-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e996b263e2a525fd4918aa17a46c17c3217c00545a2a9d5e6b8cfbbf45e5f475
BLAKE2b-256 checksum
How to use checksums
2fb81c8821e4982401336d2f86b66189d6c0085c7499fa1f578ac7fbf449b03b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/49.6.0.post20200925 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.7

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page