Skip to content

[Test]Changelong generation #119

[Test]Changelong generation

[Test]Changelong generation #119

Workflow file for this run

name: Upload Python Package
on:
push:
tags:
- v*.**
branches:
- develop
pull_request:
branches:
- develop
- legacy/.*
workflow_dispatch:
permissions:
contents: read
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest-8, macos-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref || github.ref }}
- name: Setup backend
uses: ./.github/actions/setup-backend
with:
python-version: "3.12"
- name: Get history and tags for SCM versioning to work
run: |
git branch
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Build wheels
uses: pypa/[email protected]
env:
HATCH_BUILD_HOOKS_ENABLE: true
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
release:
needs: build_wheels
runs-on: ubuntu-latest-8
permissions:
contents: write
environment: release
steps:
- uses: actions/checkout@v4
- name: Setup backend
uses: ./.github/actions/setup-backend
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-1
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
pattern: wheels-*
- name: Release to AWS codeartifact
run: |
export UV_PUBLISH_PASSWORD="$(aws codeartifact get-authorization-token --domain codegen --domain-owner 922078275900 --region us-east-1 --query authorizationToken --output text)"
export UV_PUBLISH_USERNAME=aws
uv publish
# - name: Release to pypi
# if: startsWith(github.ref, 'refs/tags/')
# run: |
# uv publish --trusted-publishing always --publish-url https://upload.pypi.org/legacy/ --keyring-provider disabled
- name: Make github release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/*
fail_on_unmatched_files: true
generate_release_notes: true
- name: Publish message to slack
uses: slackapi/[email protected]
if: success() && startsWith(github.ref, 'refs/tags/')
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "✅ New codegen-sdk Release Successfully Published! 🚀",
"emoji": true
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Version:* ${{ github.ref_name }}\n*Released by:* <${{ github.server_url }}/${{ github.actor }}|@${{ github.actor }}>\n\n*Links:*\n• <${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}|GitHub Release>\n• <https://pypi.org/project/codegen-sdk/${{ github.ref_name }}|PyPI Package>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "<!date^${{ github.event.release.published_at }}^Published {date_num} at {time}|Published just now>"
}
]
}
]
}
- name: Publish failed message to slack
uses: slackapi/[email protected]
if: failure() && startsWith(github.ref, 'refs/tags/')
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "❌ codegen-sdk Release Failed",
"emoji": true
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Version:* ${{ github.ref_name }}\n*Attempted by:* <${{ github.server_url }}/${{ github.actor }}|@${{ github.actor }}>\n\n*Details:*\n• Failed to publish version ${{ github.ref_name }}\n• <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View workflow run>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Failed at <!date^${{ github.event.release.published_at }}^{date_num} {time}|just now>"
}
]
}
]
}