Update types-aiobotocore docs #392
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: Update types-aiobotocore docs | |
concurrency: update | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
inputs: | |
force: | |
required: false | |
default: false | |
type: boolean | |
description: Skip version check | |
jobs: | |
check-version: | |
name: Check aiobotocore version | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.vars.outputs.version }} | |
current-version: ${{ steps.vars.outputs.current-version }} | |
aiobotocore-version: ${{ steps.vars.outputs.aiobotocore-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Extract versions | |
id: vars | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const fs = require('fs') | |
const { setupGlobals, getAioBotocoreVersion } = require('./.github/workflows/helpers.js') | |
setupGlobals({ core, context, fetch }) | |
core.setOutput('version', '') | |
const currentAioBotocoreVersion = fs.readFileSync('./aiobotocore_version.txt', 'utf8').trim() | |
const force = context.payload.inputs ? context.payload.inputs.force !== 'false' : false | |
const aioBotocoreVersion = await getAioBotocoreVersion() | |
if (!force && currentAioBotocoreVersion === aioBotocoreVersion) { | |
core.info(`No updates, ${aioBotocoreVersion} is still the latest`) | |
return | |
} | |
core.info(`Updating to ${aioBotocoreVersion} over ${currentAioBotocoreVersion}`) | |
core.setOutput('version', aioBotocoreVersion) | |
core.setOutput('current-version', currentAioBotocoreVersion) | |
core.setOutput('aiobotocore-version', aioBotocoreVersion) | |
update-docs: | |
name: Update docs | |
runs-on: ubuntu-latest | |
needs: check-version | |
if: needs.check-version.outputs.version | |
env: | |
VERSION: ${{ needs.check-version.outputs.version }} | |
AIOBOTOCORE_VERSION: ${{ needs.check-version.outputs.aiobotocore-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: docs | |
- name: Setup git | |
run: | | |
git config --global user.email "github-actions@github.com" | |
git config --global user.name "github-actions" | |
- name: Reset branch to main | |
run: | | |
git fetch origin main:main | |
git reset --hard main | |
git rebase main | |
- name: Get boto3 download links | |
id: links | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const { setupGlobals, extractAioBotocoreDownloadLinks } = require('./.github/workflows/helpers.js') | |
setupGlobals({ core, context, fetch }) | |
await extractAioBotocoreDownloadLinks() | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: "pip" | |
- name: Install aiobotocore | |
run: | | |
mkdir installtemp | |
cd installtemp | |
wget ${{ steps.links.outputs.aiobotocore-url }} | |
python -m pip install aiobotocore*.whl | |
cd .. | |
rm -rf installtemp | |
- name: Install dependencies | |
run: | | |
python -m pip install -r requirements.txt | |
- name: Build docs | |
run: | | |
rm -rf docs | |
rm -rf docsmd | |
mkdir -p docsmd | |
python -m mypy_boto3_builder ./docsmd --product aiobotocore-docs | |
- name: Build html docs | |
run: | | |
python -m mkdocs build | |
cp -r ./js ./docs | |
- name: Commit docs | |
run: | | |
git add docs docsmd | |
git commit -m "Generate docs for ${VERSION}" | |
git push -f | |
- name: Update Read the docs | |
env: | |
TOKEN: ${{ secrets.RTD_TOKEN }} | |
run: | | |
curl -X POST -H "Authorization: Token ${TOKEN}" https://readthedocs.org/api/v3/projects/types-aiobotocore/versions/latest/builds/ | |
update-marker: | |
name: Update marker file | |
runs-on: ubuntu-latest | |
needs: | |
- check-version | |
- update-docs | |
if: needs.check-version.outputs.current-version != needs.check-version.outputs.version | |
env: | |
VERSION: ${{ needs.check-version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup git | |
run: | | |
git config --global user.email "github-actions@github.com" | |
git config --global user.name "github-actions" | |
- name: Update marker file | |
run: | | |
echo $VERSION > ./aiobotocore_version.txt | |
- name: Commit marker file | |
run: | | |
git add aiobotocore_version.txt | |
git commit -m "Update marker to ${VERSION}" | |
git push |