-
Notifications
You must be signed in to change notification settings - Fork 30
73 lines (60 loc) · 1.81 KB
/
build-and-publish.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
name: Build and Publish
on:
workflow_dispatch: # Only manual trigger and only for the main branch
branches:
- main
inputs:
bump_level:
type: choice
description: Select bump level
required: true
options:
- patch
- minor
- major
permissions:
contents: write
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.GIT_TOKEN_TIM }}
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3 - --version 1.2.2
- name: Build and publish
run: |
set -euv
BUMP_LEVEL=${{ github.event.inputs.bump_level }}
echo "bump level: ${BUMP_LEVEL}"
git config --local user.email "Bumpversion"
git config --local user.name "Bumpversion"
# Version bump
NEW_VERSION=$(poetry version -s ${BUMP_LEVEL})
echo ${NEW_VERSION}
git add pyproject.toml poetry.lock
git commit -m "Bump version to ${NEW_VERSION}"
git tag "v${NEW_VERSION}"
git push -f
git push --tags -f
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish --build
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.NEW_VERSION }}
release_name: v${{ env.NEW_VERSION }}
body: |
pypi package: https://pypi.org/project/pydantic-avro/${{ env.NEW_VERSION }}/
draft: false
prerelease: false