-
-
Notifications
You must be signed in to change notification settings - Fork 35
163 lines (149 loc) · 5.53 KB
/
publish_types_aioboto3.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
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} \
--download-static-stubs \
-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