-
Notifications
You must be signed in to change notification settings - Fork 3
91 lines (86 loc) · 2.77 KB
/
publish_on_update.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
name: Publish botocore-stubs
concurrency: publish
on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
inputs:
force:
required: false
default: false
type: boolean
description: Force build even if consistency check fails (set to true)
version:
required: false
default: ""
type: string
description: Use a specific package version, latest otherwise
env:
PACKAGE: botocore
STUBS: botocore-stubs
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@v4
- name: Extract versions
id: vars
uses: actions/github-script@v7
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@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install the project
run: uv sync --dev
- name: Install package
run: uv pip install ${PACKAGE}==${VERSION}
- name: Stubs consistency check
if: "${{ github.event.inputs.force != 'true' }}"
run: |
uv run istub -d
- name: Bump version
run: |
echo "Bumping version to ${STUBS_VERSION}"
sed -i 's/^version = ".*"$/version = "'$STUBS_VERSION'"/' pyproject.toml
uv pip install .
- 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: |
uvx --from build pyproject-build --installer uv
uvx twine upload --non-interactive dist/*
- name: Report status
uses: actions/github-script@v7
with:
script: |
core.notice(`Released ${process.env.STUBS} ${process.env.STUBS_VERSION}`)