Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc83ff7a

Browse files
authored
ci: send tweet on release (pydantic#1482)
1 parent4bf310c commitc83ff7a

File tree

1 file changed

+55
-4
lines changed

1 file changed

+55
-4
lines changed

‎.github/workflows/ci.yml

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
test-live:
9393
runs-on:ubuntu-latest
9494
timeout-minutes:5
95-
if:"github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'"
95+
if:github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
9696
steps:
9797
-uses:actions/checkout@v4
9898

@@ -275,7 +275,7 @@ jobs:
275275

276276
deploy-docs:
277277
needs:[check]
278-
if:"success() && startsWith(github.ref, 'refs/tags/')"
278+
if:success() && startsWith(github.ref, 'refs/tags/')
279279
runs-on:ubuntu-latest
280280
environment:
281281
name:deploy-docs
@@ -311,15 +311,22 @@ jobs:
311311
env:
312312
ALGOLIA_WRITE_API_KEY:${{ secrets.ALGOLIA_WRITE_API_KEY }}
313313

314+
# TODO(Marcelo): We need to split this into two jobs: `build` and `release`.
314315
release:
315316
needs:[check]
316-
if:"success() && startsWith(github.ref, 'refs/tags/')"
317+
if:success() && startsWith(github.ref, 'refs/tags/')
317318
runs-on:ubuntu-latest
318-
environment:release
319+
320+
environment:
321+
name:release
322+
url:https://pypi.org/project/pydantic-ai/${{ steps.inspect_package.outputs.version }}
319323

320324
permissions:
321325
id-token:write
322326

327+
outputs:
328+
package-version:${{ steps.inspect_package.outputs.version }}
329+
323330
steps:
324331
-uses:actions/checkout@v4
325332

@@ -329,7 +336,51 @@ jobs:
329336

330337
-run:uv build --all-packages
331338

339+
-name:Inspect package version
340+
id:inspect_package
341+
run:|
342+
version=$(uvx hatchling version)
343+
echo "version=$version" >> "$GITHUB_OUTPUT"
344+
332345
-name:Publish to PyPI
333346
uses:pypa/gh-action-pypi-publish@release/v1
334347
with:
335348
skip-existing:true
349+
350+
send-tweet:
351+
name:Send tweet
352+
needs:[release]
353+
if:needs.release.result == 'success'
354+
runs-on:ubuntu-latest
355+
356+
steps:
357+
-uses:actions/setup-python@v5
358+
with:
359+
python-version:'3.12'
360+
-name:Install dependencies
361+
run:pip install tweepy==4.14.0
362+
-name:Send tweet
363+
shell:python
364+
run:|
365+
import os
366+
import tweepy
367+
368+
client = tweepy.Client(
369+
access_token=os.getenv("TWITTER_ACCESS_TOKEN"),
370+
access_token_secret=os.getenv("TWITTER_ACCESS_TOKEN_SECRET"),
371+
consumer_key=os.getenv("TWITTER_CONSUMER_KEY"),
372+
consumer_secret=os.getenv("TWITTER_CONSUMER_SECRET"),
373+
)
374+
version = os.getenv("VERSION").strip('"')
375+
tweet = os.getenv("TWEET").format(version=version)
376+
client.create_tweet(text=tweet)
377+
env:
378+
VERSION:${{ needs.release.outputs.package-version }}
379+
TWEET:|
380+
PydanticAI version {version} is out! 🎉
381+
382+
https://github.com/pydantic/pydantic-ai/releases/tag/v{version}
383+
TWITTER_CONSUMER_KEY:${{ secrets.TWITTER_CONSUMER_KEY }}
384+
TWITTER_CONSUMER_SECRET:${{ secrets.TWITTER_CONSUMER_SECRET }}
385+
TWITTER_ACCESS_TOKEN:${{ secrets.TWITTER_ACCESS_TOKEN }}
386+
TWITTER_ACCESS_TOKEN_SECRET:${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp