|
| 1 | +name: release-announcements |
| 2 | +# Automatic release toot and tweet anouncements |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + toot: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: rzr/fediverse-action@master |
| 13 | + with: |
| 14 | + access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }} |
| 15 | + host: "mstdn.science" # custom host if not "mastodon.social" (default) |
| 16 | + # GitHub event payload |
| 17 | + # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#release |
| 18 | + message: | |
| 19 | + Pipeline release! ${{ github.repository }} v${{ github.event.release.tag_name }} - ${{ github.event.release.name }}! |
| 20 | +
|
| 21 | + Please see the changelog: ${{ github.event.release.html_url }} |
| 22 | +
|
| 23 | + send-tweet: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + |
| 26 | + steps: |
| 27 | + - uses: actions/setup-python@v4 |
| 28 | + with: |
| 29 | + python-version: "3.10" |
| 30 | + - name: Install dependencies |
| 31 | + run: pip install tweepy==4.14.0 |
| 32 | + - name: Send tweet |
| 33 | + shell: python |
| 34 | + run: | |
| 35 | + import os |
| 36 | + import tweepy |
| 37 | +
|
| 38 | + client = tweepy.Client( |
| 39 | + access_token=os.getenv("TWITTER_ACCESS_TOKEN"), |
| 40 | + access_token_secret=os.getenv("TWITTER_ACCESS_TOKEN_SECRET"), |
| 41 | + consumer_key=os.getenv("TWITTER_CONSUMER_KEY"), |
| 42 | + consumer_secret=os.getenv("TWITTER_CONSUMER_SECRET"), |
| 43 | + ) |
| 44 | + tweet = os.getenv("TWEET") |
| 45 | + client.create_tweet(text=tweet) |
| 46 | + env: |
| 47 | + TWEET: | |
| 48 | + Pipeline release! ${{ github.repository }} v${{ github.event.release.tag_name }} - ${{ github.event.release.name }}! |
| 49 | +
|
| 50 | + Please see the changelog: ${{ github.event.release.html_url }} |
| 51 | + TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} |
| 52 | + TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} |
| 53 | + TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} |
| 54 | + TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} |
| 55 | + |
| 56 | + bsky-post: |
| 57 | + runs-on: ubuntu-latest |
| 58 | + steps: |
| 59 | + - uses: zentered/[email protected] |
| 60 | + with: |
| 61 | + post: | |
| 62 | + Pipeline release! ${{ github.repository }} v${{ github.event.release.tag_name }} - ${{ github.event.release.name }}! |
| 63 | +
|
| 64 | + Please see the changelog: ${{ github.event.release.html_url }} |
| 65 | + env: |
| 66 | + BSKY_IDENTIFIER: ${{ secrets.BSKY_IDENTIFIER }} |
| 67 | + BSKY_PASSWORD: ${{ secrets.BSKY_PASSWORD }} |
| 68 | + # |
0 commit comments