Publish types-awscrt #778
This file contains 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: Publish types-awscrt | |
concurrency: publish | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
inputs: | |
force: | |
required: false | |
type: boolean | |
default: false | |
description: Force build even if consistency check fails (set to true) | |
version: | |
required: false | |
default: "" | |
type: string | |
description: Use a specific package version, latest otherwise | |
env: | |
PACKAGE: awscrt | |
STUBS: types-awscrt | |
jobs: | |
check-version: | |
name: Check version | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.vars.outputs.version }} | |
stubs-version: ${{ steps.vars.outputs.stubs-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract versions | |
id: vars | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { setupGlobals, extractVersions } = require('./.github/workflows/helpers.js') | |
setupGlobals({ fetch, core, context }) | |
await extractVersions() | |
publish-stubs: | |
name: Publish stubs | |
runs-on: ubuntu-latest | |
needs: check-version | |
if: needs.check-version.outputs.stubs-version | |
env: | |
VERSION: ${{ needs.check-version.outputs.version }} | |
STUBS_VERSION: ${{ needs.check-version.outputs.stubs-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install -U poetry pip | |
poetry install -n | |
poetry run pip install -U twine | |
- name: Install package | |
run: | | |
poetry run pip install ${PACKAGE}==${VERSION} | |
- name: Stubs consistency check | |
if: "${{ github.event.inputs.force != 'true' }}" | |
run: | | |
poetry run istub -d | |
- name: Bump version | |
run: | | |
echo "Bumping version to ${STUBS_VERSION}" | |
poetry version ${STUBS_VERSION} | |
rm -rf *.egg-info || true | |
poetry install -n | |
- name: Commit changes | |
if: "${{ github.event.inputs.version == '' }}" | |
run: | | |
git config --global user.email "github-actions@github.com" | |
git config --global user.name "github-actions" | |
git add pyproject.toml | |
git commit -m "Release ${STUBS_VERSION}" | |
git push | |
- name: Publish to PyPI | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
poetry build | |
poetry run twine upload --non-interactive dist/* | |
- name: Report status | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
core.notice(`Released ${process.env.STUBS} ${process.env.STUBS_VERSION}`) |