Publish types-s3transfer #470
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-s3transfer | |
concurrency: publish | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
inputs: | |
force: | |
required: false | |
type: boolean | |
default: false | |
description: Publish new postrelease if the version exists | |
version: | |
required: false | |
default: "" | |
type: string | |
description: Use a specific package version, latest otherwise | |
env: | |
PACKAGE: s3transfer | |
STUBS: types-s3transfer | |
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@v3 | |
- name: Extract versions | |
id: vars | |
uses: actions/github-script@v6 | |
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@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
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 | |
- 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@v6 | |
with: | |
script: | | |
core.notice(`Released ${process.env.STUBS} ${process.env.STUBS_VERSION}`) |