Skip to content

Commit

Permalink
ci: automatically publish to package managers (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored Oct 16, 2023
1 parent cb0bd8c commit ed6d0c1
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .github/workflows/create-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,17 @@ jobs:
with:
repo: ${{ github.event.repository.full_name }}
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}

- name: Set up Python
if: ${{ steps.release.outputs.releases_created }}
uses: actions/setup-python@v4
with:
python-version: '3.7'

- name: Publish to PyPI
if: ${{ steps.release.outputs.releases_created }}
run: |
pipx install poetry
bash ./bin/publish-pypi
env:
PYPI_TOKEN: ${{ secrets.ANTHROPIC_PYPI_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# workflow for re-running publishing to PyPI in case it fails for some reason
# you can run this workflow by navigating to https://www.github.com/anthropics/anthropic-sdk-python/actions/workflows/publish-pypi.yml
name: Publish PyPI
on:
workflow_dispatch:

jobs:
publish:
name: publish
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.7'

- name: Publish to PyPI
run: |
pipx install poetry
bash ./bin/publish-pypi
env:
PYPI_TOKEN: ${{ secrets.ANTHROPIC_PYPI_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ jobs:
bash ./bin/check-release-environment
env:
STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
PYPI_TOKEN: ${{ secrets.ANTHROPIC_PYPI_TOKEN }}
4 changes: 4 additions & 0 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ if [ -z "${STAINLESS_API_KEY}" ]; then
errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organisation secrets on GitHub.")
fi

if [ -z "${PYPI_TOKEN}" ]; then
errors+=("The ANTHROPIC_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organisation secrets.")
fi

len=${#errors[@]}

if [[ len -gt 0 ]]; then
Expand Down
2 changes: 1 addition & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
}
],
"reviewers": [
"RobertCraigie"
"@anthropics/sdk"
],
"release-type": "python",
"extra-files": [
Expand Down

0 comments on commit ed6d0c1

Please sign in to comment.