Publish types-aioboto3 #531
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-aioboto3 | |
concurrency: update_types_aioboto3 | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
inputs: | |
aioboto3_version: | |
description: Target aioboto3 version | |
required: false | |
type: string | |
default: "" | |
force: | |
description: Continue if version is already published | |
required: false | |
default: false | |
type: boolean | |
stubs_version: | |
description: Specify version explicitly instead of finding it automatically | |
required: false | |
type: string | |
default: "" | |
no_smart_version: | |
description: Use exact version provided in stubs_version | |
required: false | |
default: false | |
type: boolean | |
jobs: | |
versions: | |
runs-on: ubuntu-latest | |
outputs: | |
aioboto3: ${{ steps.aioboto3.outputs.result }} | |
aioboto3-url: ${{ steps.aioboto3-url.outputs.result }} | |
version: ${{ steps.version.outputs.result }} | |
extra-flags: ${{ steps.extra-flags.outputs.result }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Find aioboto3 version | |
id: aioboto3 | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: | | |
const { getAioBoto3Version, setupGlobals } = require('./.github/workflows/helpers.js') | |
setupGlobals({ core, context, fetch }) | |
const inputVersion = context.payload.inputs && context.payload.inputs.aioboto3_version | |
const version = inputVersion ? inputVersion : await getAioBoto3Version() | |
core.notice(`aioboto3 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 aioboto3Version = "${{ steps.aioboto3.outputs.result }}" | |
const versions = await getPackageVersions('types-aioboto3', aioboto3Version) | |
core.info(`Built versions ${versions}`) | |
if (!versions.length) { | |
core.notice(`No builds found, building initial ${aioboto3Version}`) | |
return aioboto3Version | |
} | |
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 noSmartVersion = context.payload.inputs ? context.payload.inputs.no_smart_version !== 'false' : true | |
if (noSmartVersion) extraFlags.push('--no-smart-version') | |
core.notice(`Extra flags = ${extraFlags}`) | |
return extraFlags.join(' ') | |
- name: Aioboto3 download URL | |
id: aioboto3-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('aioboto3', "${{ steps.aioboto3.outputs.result }}") | |
core.notice(`aioboto3 download URL ${url}`) | |
return url | |
publish-types-aioboto3: | |
name: Publish types-aioboto3 | |
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 aioboto3 | |
run: | | |
mkdir installtemp | |
cd installtemp | |
wget ${{ needs.versions.outputs.aioboto3-url }} | |
pip uninstall -y s3transfer | |
pip install aioboto3* 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 aioboto3 ${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 |