Skip to content

Commit db893f1

Browse files
committed
add create-tweet-on-x.yml
1 parent 78eb9b2 commit db893f1

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Create Tweet on X
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
jobs:
8+
tweet:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/setup-go@v5
12+
with:
13+
go-version: stable
14+
- name: Create Tweet on X
15+
run: |
16+
go install github.com/DanielLiu1123/xcli/cmd/xcli@latest
17+
18+
RELEASE_TAG="${{ github.event.release.tag_name }}"
19+
REPO_NAME="${{ github.repository }}"
20+
REPO_DESCRIPTION="${{ github.event.repository.description }}"
21+
22+
TWEET_TEXT=$(printf "🎉 %s has released %s!\n\n%s: %s\n\n#Java #Junit\n\n🔗 Check it out: %s" \
23+
"${REPO_NAME}" \
24+
"${RELEASE_TAG}" \
25+
"${REPO_NAME#*/}" \
26+
"${REPO_DESCRIPTION}" \
27+
"https://github.com/${REPO_NAME}/releases/tag/${RELEASE_TAG}"
28+
)
29+
30+
echo "Tweeting content:"
31+
echo "${TWEET_TEXT}"
32+
33+
xcli tweet create --text="${TWEET_TEXT}" \
34+
--api-key="${{ secrets.X_API_KEY }}" \
35+
--api-secret="${{ secrets.X_API_SECRET }}" \
36+
--access-token="${{ secrets.X_ACCESS_TOKEN }}" \
37+
--access-secret="${{ secrets.X_ACCESS_SECRET }}"

0 commit comments

Comments
 (0)