Skip to content

Commit

Permalink
[Add] post to twitter github release
Browse files Browse the repository at this point in the history
  • Loading branch information
JanGalek committed Jan 29, 2025
1 parent 847e1bd commit 233a5f8
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,39 @@ on:

jobs:
call-release:
uses: gouef/github-lib-template/.github/workflows/shared_release.yml@main
with:
branch: ${{ github.ref_name }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Create release
uses: gouef/release-action@main
with:
branch: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: pip install tweepy

- name: Send tweet
env:
TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
run: |
python - <<EOF
import tweepy
import os
client = tweepy.Client(
consumer_key=os.getenv("TWITTER_CONSUMER_API_KEY"),
consumer_secret=os.getenv("TWITTER_CONSUMER_API_SECRET"),
access_token=os.getenv("TWITTER_ACCESS_TOKEN"),
access_token_secret=os.getenv("TWITTER_ACCESS_TOKEN_SECRET")
)
tweet_text = f"🚀 New version of {os.getenv('GITHUB_REF_NAME')} just released! 🎉\n\n{os.getenv('GITHUB_SERVER_URL')}/{os.getenv('GITHUB_REPOSITORY')}/releases/latest"
response = client.create_tweet(text=tweet_text)
print(f"Tweet odeslán: {response}")
EOF

0 comments on commit 233a5f8

Please sign in to comment.