Publish types-aiobotocore #888
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-aiobotocore | |
concurrency: update_types_aiobotocore | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
inputs: | |
aiobotocore_version: | |
description: Target aiobotocore version | |
required: false | |
type: string | |
stubs_version: | |
description: Specify version explicitly instead of finding it automatically | |
required: false | |
default: "" | |
type: string | |
force: | |
description: Continue if version is already published | |
required: false | |
default: false | |
type: boolean | |
skip_published: | |
description: Skip already published packages | |
required: false | |
default: true | |
type: boolean | |
no_smart_version: | |
description: Use exact version provided in stubs_version | |
required: false | |
default: false | |
type: boolean | |
jobs: | |
versions: | |
runs-on: ubuntu-latest | |
outputs: | |
aiobotocore: ${{ steps.aiobotocore.outputs.result }} | |
aiobotocore-url: ${{ steps.aiobotocore-url.outputs.result }} | |
version: ${{ steps.version.outputs.result }} | |
extra-flags: ${{ steps.extra-flags.outputs.result }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Find aiobotocore version | |
id: aiobotocore | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: | | |
const { getAioBotocoreVersion, setupGlobals } = require('./.github/workflows/helpers.js') | |
setupGlobals({ core, context, fetch }) | |
const inputVersion = context.payload.inputs && context.payload.inputs.aiobotocore_version | |
const version = inputVersion ? inputVersion : await getAioBotocoreVersion() | |
core.notice(`aiobotocore version ${version}`) | |
return version | |
- name: Find build version | |
id: version | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: | | |
const { getPackageVersions, getNextPostVersion, setupGlobals } = require('./.github/workflows/helpers.js') | |
setupGlobals({ core, context, fetch }) | |
if (context.payload.inputs && context.payload.inputs.stubs_version) { | |
const version = context.payload.inputs.stubs_version | |
core.notice(`stubs version ${version}`) | |
return version | |
} | |
const force = context.payload.inputs ? context.payload.inputs.force !== 'false' : false | |
const aiobotocoreVersion = "${{ steps.aiobotocore.outputs.result }}" | |
const versions = await getPackageVersions('types-aiobotocore', aiobotocoreVersion) | |
core.info(`Built versions ${versions}`) | |
if (!versions.length) { | |
core.notice(`No builds found, building initial ${aiobotocoreVersion}`) | |
return aiobotocoreVersion | |
} | |
if (!force) { | |
core.notice(`Builds ${versions} found, skipping`) | |
return '' | |
} | |
const lastVersion = versions.pop() | |
core.notice(`Last version ${lastVersion}`) | |
const version = getNextPostVersion(lastVersion) | |
core.notice(`Version ${version}`) | |
return version | |
- name: Extra flags | |
id: extra-flags | |
if: steps.version.outputs.result | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: | | |
const extraFlags = [] | |
const skipPublished = context.payload.inputs ? context.payload.inputs.skip_published !== 'false' : true | |
const noSmartVersion = context.payload.inputs ? context.payload.inputs.no_smart_version !== 'false' : true | |
if (skipPublished) extraFlags.push('--skip-published') | |
if (noSmartVersion) extraFlags.push('--no-smart-version') | |
core.notice(`Extra flags = ${extraFlags}`) | |
return extraFlags.join(' ') | |
- name: Aiobotocore download URL | |
id: aiobotocore-url | |
if: steps.version.outputs.result | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: | | |
const { getDownloadURL, setupGlobals } = require('./.github/workflows/helpers.js') | |
setupGlobals({ core, context, fetch }) | |
const url = await getDownloadURL('aiobotocore', "${{ steps.aiobotocore.outputs.result }}") | |
core.notice(`aiobotocore download URL ${url}`) | |
return url | |
publish-types-aiobotocore: | |
name: Publish types-aiobotocore | |
runs-on: ubuntu-latest | |
needs: versions | |
if: needs.versions.outputs.version | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: pyproject.toml | |
- name: Install builder | |
run: | | |
rm -rf mypy_boto3_builder | |
python -m pip install mypy_boto3_builder | |
- name: Install aiobotocore | |
run: | | |
mkdir installtemp | |
cd installtemp | |
wget ${{ needs.versions.outputs.aiobotocore-url }} | |
pip uninstall -y s3transfer | |
pip install aiobotocore*.whl s3transfer | |
cd .. | |
rm -rf installtemp | |
- name: Build all packages | |
env: | |
VERSION: ${{ needs.versions.outputs.version }} | |
EXTRA_FLAGS: ${{ needs.versions.outputs.extra-flags }} | |
run: | | |
rm -rf mypy_boto3_output/* | |
echo "Building all packages" | |
python -m mypy_boto3_builder mypy_boto3_output -b ${VERSION} --product aiobotocore aiobotocore-services ${EXTRA_FLAGS} -s all -d | |
- name: Install dependencies for publishing | |
run: | | |
python -m pip install setuptools wheel twine | |
- name: Publish to PyPI | |
env: | |
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
python ./scripts/release.py |