Skip to content

chore: release main (#113) #110

chore: release main (#113)

chore: release main (#113) #110

# This workflow handles both automated and manual package publishing:
#
# AUTOMATED PUBLISHING (on push to main):
# - Triggered automatically when changes are pushed to the main branch
# - Uses release-please to create releases based on conventional commits
# - Publishes packages to PyPI automatically when release PRs are merged
#
# MANUAL PUBLISHING (via workflow_dispatch):
# - Can be triggered manually from the Actions tab
# - Allows publishing a specific package to PyPI
# - Supports dry-run mode
#
name: release-please
on:
push:
branches:
- main
workflow_dispatch:
inputs:
workspace_path:
description: 'The workspace to publish'
required: true
default: 'packages/sdk/server-ai'
type: choice
options:
- packages/sdk/server-ai
- packages/ai-providers/server-ai-langchain
- packages/ai-providers/server-ai-openai
- packages/optimization
dry_run:
description: 'Is this a dry run. If so no package will be published.'
type: boolean
required: true
jobs:
release-please:
runs-on: ubuntu-latest
permissions:
contents: write # Needed for release-please to create releases.
pull-requests: write # Needed for release-please to create/update PRs.
if: github.event_name == 'push'
outputs:
package-server-ai-released: ${{ steps.release.outputs['packages/sdk/server-ai--release_created'] }}
package-server-ai-tag-name: ${{ steps.release.outputs['packages/sdk/server-ai--tag_name'] }}
package-server-ai-langchain-released: ${{ steps.release.outputs['packages/ai-providers/server-ai-langchain--release_created'] }}
package-server-ai-langchain-tag-name: ${{ steps.release.outputs['packages/ai-providers/server-ai-langchain--tag_name'] }}
package-server-ai-openai-released: ${{ steps.release.outputs['packages/ai-providers/server-ai-openai--release_created'] }}
package-server-ai-openai-tag-name: ${{ steps.release.outputs['packages/ai-providers/server-ai-openai--tag_name'] }}
package-server-ai-optimization-released: ${{ steps.release.outputs['packages/optimization--release_created'] }}
package-server-ai-optimization-tag-name: ${{ steps.release.outputs['packages/optimization--tag_name'] }}
steps:
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4
id: release
release-server-ai:
runs-on: ubuntu-latest
needs: ['release-please']
permissions:
id-token: write # Needed for OIDC to get release secrets from AWS.
attestations: write # Needed for actions/attest.
if: ${{ needs.release-please.outputs.package-server-ai-released == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci
with:
workspace_path: packages/sdk/server-ai
- uses: ./.github/actions/build
id: build
with:
workspace_path: packages/sdk/server-ai
- name: Attest build provenance
uses: actions/attest@v4
with:
subject-path: 'packages/sdk/server-ai/dist/*'
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
name: 'Get PyPI token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
password: ${{ env.PYPI_AUTH_TOKEN }}
packages-dir: packages/sdk/server-ai/dist/
release-server-ai-langchain:
runs-on: ubuntu-latest
needs: ['release-please']
permissions:
id-token: write # Needed for OIDC to get release secrets from AWS.
attestations: write # Needed for actions/attest.
if: ${{ needs.release-please.outputs.package-server-ai-langchain-released == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci
with:
workspace_path: packages/ai-providers/server-ai-langchain
- uses: ./.github/actions/build
id: build
with:
workspace_path: packages/ai-providers/server-ai-langchain
- name: Attest build provenance
uses: actions/attest@v4
with:
subject-path: 'packages/ai-providers/server-ai-langchain/dist/*'
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
name: 'Get PyPI token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
password: ${{ env.PYPI_AUTH_TOKEN }}
packages-dir: packages/ai-providers/server-ai-langchain/dist/
manual-publish:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
permissions:
id-token: write # Needed for OIDC to get release secrets from AWS.
contents: read # Needed for actions/checkout.
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci
with:
workspace_path: ${{ inputs.workspace_path }}
- uses: ./.github/actions/build
id: build
with:
workspace_path: ${{ inputs.workspace_path }}
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
if: ${{ format('{0}', inputs.dry_run) != 'true' }}
name: 'Get PyPI token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'
- name: Publish to PyPI
if: ${{ format('{0}', inputs.dry_run) != 'true' }}
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
password: ${{ env.PYPI_AUTH_TOKEN }}
packages-dir: ${{ inputs.workspace_path }}/dist/
release-server-ai-openai:
runs-on: ubuntu-latest
needs: ['release-please']
permissions:
id-token: write # Needed for OIDC to get release secrets from AWS.
attestations: write # Needed for actions/attest.
if: ${{ needs.release-please.outputs.package-server-ai-openai-released == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci
with:
workspace_path: packages/ai-providers/server-ai-openai
- uses: ./.github/actions/build
id: build
with:
workspace_path: packages/ai-providers/server-ai-openai
- name: Attest build provenance
uses: actions/attest@v4
with:
subject-path: 'packages/ai-providers/server-ai-openai/dist/*'
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
name: 'Get PyPI token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
password: ${{ env.PYPI_AUTH_TOKEN }}
packages-dir: packages/ai-providers/server-ai-openai/dist/
release-server-ai-optimization:
runs-on: ubuntu-latest
needs: ['release-please']
permissions:
id-token: write # Needed for OIDC to get release secrets from AWS.
attestations: write # Needed for actions/attest.
if: ${{ needs.release-please.outputs.package-server-ai-optimization-released == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/ci
with:
workspace_path: packages/optimization
- uses: ./.github/actions/build
id: build
with:
workspace_path: packages/optimization
- name: Attest build provenance
uses: actions/attest@v4
with:
subject-path: 'packages/optimization/dist/*'
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0
name: 'Get PyPI token'
with:
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
ssm_parameter_pairs: '/production/common/releasing/pypi/token = PYPI_AUTH_TOKEN'
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
password: ${{ env.PYPI_AUTH_TOKEN }}
packages-dir: packages/optimization/dist/