Skip to content

ci: add publish job to publish from release-please (#478) #205

ci: add publish job to publish from release-please (#478)

ci: add publish job to publish from release-please (#478) #205

name: On push to main branch
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Setup repo
uses: actions/checkout@v4
with:
token: ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}
- name: Generate README
uses: momentohq/standards-and-practices/github-actions/generate-and-commit-oss-readme@gh-actions-v2
with:
project_status: official
project_stability: stable
project_type: sdk
sdk_language: Python
dev_docs_slug: python
template_file: ./README.template.md
output_file: ./README.md
release-please:
needs: [build]
runs-on: ubuntu-24.04
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: actions/checkout@v4
- uses: googleapis/release-please-action@v4
name: Release Please
id: release
with:
token: ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}
release-type: python
publish:
needs: [release-please]
if: ${{ needs.release-please.outputs.release_created == 'true' }}
runs-on: ubuntu-24.04
env:
VERSION: ${{ needs.release-please.outputs.tag_name }}
steps:
- name: Setup repo
uses: actions/checkout@v4
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.1
virtualenvs-in-project: true
- name: Setup Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Build package
run: poetry build
- name: Publish package
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYTHON_CUSTOMER_SDK_PYPI_TOKEN }}
run: |
if [ -z "$VERSION" ]
then
echo "Unable to determine SDK version! Exiting!"
exit 1
fi
echo "Going to publish version=$VERSION"
poetry publish