Release Action #25
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Action | |
on: | |
release: | |
types: | |
- published | |
workflow_dispatch: # for testing | |
jobs: | |
publish-package: | |
runs-on: ubuntu-latest | |
name: Publish to PyPI | |
steps: | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for all tags and branches | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.13 | |
- name: Initialize pants | |
uses: pantsbuild/actions/init-pants@main | |
with: | |
gha-cache-key: cache0-py3.13 | |
named-caches-hash: ${{ hashFiles('requirements.txt') }} | |
- name: Publish to PyPI | |
run: | | |
# Get the previous tag | |
previous_tag=$(git describe --tags --abbrev=0 HEAD^) | |
echo "Comparing changes since $previous_tag" | |
# Get list of changed targets since the previous tag | |
changed_targets=$(pants --changed-since=$previous_tag list | awk -F/ '{print $1}' | sort -u) | |
if [ -n "$changed_targets" ]; then | |
echo "Publishing changed targets: $changed_targets" | |
for target in $changed_targets; do | |
pants publish $target:: | |
done | |
else | |
echo "No changes detected, skipping publish" | |
fi | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
# notify-release: | |
# runs-on: ubuntu-latest | |
# name: Notify Release | |
# strategy: | |
# matrix: | |
# url: [SLACK_WEBHOOK_ASK_DEVREL_URL, SLACK_WEBHOOK_DEVREL_TOOLING_URL, SLACK_WEBHOOK_DEVREL_PRIVATE_URL] | |
# steps: | |
# - name: Send to slack channels | |
# uses: slackapi/slack-github-action@v2.0.0 | |
# if: always() | |
# continue-on-error: true | |
# with: | |
# webhook: ${{ secrets[matrix.url]}} | |
# webhook-type: incoming-webhook | |
# errors: true | |
# payload: | | |
# blocks: | |
# - type: "header" | |
# text: | |
# type: "plain_text" | |
# text: ":initial_external_notification_sent: :python: Version ${{ github.event.release.name }} of the Python SDK has been released" | |
# - type: "section" | |
# text: | |
# type: "mrkdwn" | |
# text: "${{ github.event.release.body }}" | |
# - type: "divider" | |
# - type: "section" | |
# text: | |
# type: "mrkdwn" | |
# text: "You can view the full change log <${{github.event.release.html_url }}|here>" |