-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (37 loc) · 1.11 KB
/
publish_main.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
name: Tag and publish main
on:
push:
branches:
- main
jobs:
tag_and_publish:
name: Parse version
runs-on: ubuntu-latest
outputs:
pkg_version: ${{ steps.output_version.outputs.pkg_version }}
steps:
- uses: actions/checkout@v3
- name: Get version from file
run: |
pkg_name=$(grep -P 'version = \{attr = .*\}' pyproject.toml | grep -oP '\w+.__version__')
init_file="./src/${pkg_name//.__version__}/__init__.py"
pkg_version=$(grep -Po '[0-9]+\.[0-9]+\.[0-9]+' "$init_file")
echo "tag=$pkg_version" >> "$GITHUB_ENV"
- name: Create git tag
run: |
git tag "v${{ env.tag }}"
- name: Push git tag
run: git push origin "v${{ env.tag }}"
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install --upgrade setuptools wheel twine build
python -m build
twine check dist/*
- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.AIND_PYPI_TOKEN }}