-
Notifications
You must be signed in to change notification settings - Fork 4
46 lines (38 loc) · 1.07 KB
/
publish_pypi.yaml
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
name: Publish Python Package to PyPI
on:
workflow_dispatch:
push:
branches:
- main
paths:
- cocotb/caravel_cocotb/version.py # Trigger the workflow only if the VERSION file changes
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install dependencies
run: |
pip install --upgrade setuptools wheel twine
- name: Read version number
id: read_version
run: |
VERSION_FILE=cocotb/caravel_cocotb/version.py
NEW_VERSION=$(cat $VERSION_FILE)
echo "New version: $NEW_VERSION"
echo "version=$NEW_VERSION" >> $GITHUB_ENV
- name: Build package
run: |
cd cocotb
python setup.py sdist bdist_wheel
- name: Publish
if: ${{ env.NEW_TAG != 'NO_NEW_TAG' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: cocotb/dist