forked from youtype/mypy_boto3_builder
127 lines (122 loc) · 4.27 KB
/
publish_boto3_stubs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Publish boto3-stubs
concurrency: update_boto3_stubs
on:
schedule:
- cron: "*/15 * * * *"
workflow_dispatch:
inputs:
boto3_version:
description: Target boto3 version
required: false
default: ""
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
build_all:
description: Build all packages instead of updated only
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:
check-boto3-version:
name: Check boto3 version
runs-on: ubuntu-latest
outputs:
boto3-version: ${{ steps.vars.outputs.boto3-version }}
botocore-version: ${{ steps.vars.outputs.botocore-version }}
version: ${{ steps.vars.outputs.version }}
build-all: ${{ steps.vars.outputs.build-all }}
extra-flags: ${{ steps.vars.outputs.extra-flags }}
steps:
- uses: actions/checkout@v4
- name: Extract versions
id: vars
uses: actions/github-script@v6
with:
script: |
const { setupGlobals, extractVersions } = require('./.github/workflows/helpers.js')
setupGlobals({ core, context, fetch })
await extractVersions()
publish-boto3-stubs:
name: Publish boto3-stubs
runs-on: ubuntu-latest
needs: check-boto3-version
if: needs.check-boto3-version.outputs.version
env:
BOTO3_VERSION: ${{ needs.check-boto3-version.outputs.boto3-version }}
BOTOCORE_VERSION: ${{ needs.check-boto3-version.outputs.botocore-version }}
VERSION: ${{ needs.check-boto3-version.outputs.version }}
EXTRA_FLAGS: ${{ needs.check-boto3-version.outputs.extra-flags }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Get boto3 download links
id: links
uses: actions/github-script@v6
with:
script: |
const { setupGlobals, extractDownloadLinks } = require('./.github/workflows/helpers.js')
setupGlobals({ core, context, fetch })
await extractDownloadLinks()
- name: Install boto3
run: |
mkdir installtemp
cd installtemp
wget ${{ steps.links.outputs.boto3-url }}
wget ${{ steps.links.outputs.botocore-url }}
pip install botocore*.whl
pip install boto3*.whl
cd ..
rm -rf installtemp
python -m pip install newversion
- name: Install builder
run: |
rm -rf mypy_boto3_builder
python -m pip install mypy_boto3_builder
- name: Build updated packages only
if: needs.check-boto3-version.outputs.build-all == 'false'
run: |
rm -rf mypy_boto3_output/*
echo "Building updated packages"
python -m mypy_boto3_builder mypy_boto3_output -b ${VERSION} --product boto3 boto3-services ${EXTRA_FLAGS} -s updated -d
- name: Build all packages
if: needs.check-boto3-version.outputs.build-all == 'true'
run: |
rm -rf mypy_boto3_output/*
echo "Building all packages"
python -m mypy_boto3_builder mypy_boto3_output -b ${VERSION} --product boto3 boto3-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
- name: Store boto3-stubs artifact
uses: actions/upload-artifact@v3
with:
name: boto3-stubs
path: mypy_boto3_output/boto3_stubs_package/dist/*.whl