generated from gouef/github-lib-template
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (49 loc) · 1.73 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Create Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for the release'
required: true
default: 'v1.0.0'
release_type:
description: 'Release type (stable, beta, rc)'
required: true
default: 'stable'
jobs:
call-release:
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_REPOSITORY')} {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