forked from flexflow/flexflow-train
-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (60 loc) · 2.09 KB
/
pip-deploy.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
name: "pip-deploy"
on:
workflow_dispatch:
concurrency:
group: pip-deploy-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-20.04
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- name: Checkout Git Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Free additional space on runner
run: .github/workflows/helpers/free_space_on_runner.sh
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a source tarball
env:
DEPLOY_TO_TEST_PYPI: ${{ vars.DEPLOY_TO_TEST_PYPI }}
run: >-
python3 -m
build
--sdist
--outdir dist/
.
- name: Publish distribution 📦 to Test PyPI
if: ${{ vars.DEPLOY_TO_TEST_PYPI == 'true' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: ${{ vars.DEPLOY_TO_TEST_PYPI == 'false' }}
uses: pypa/gh-action-pypi-publish@release/v1
- name: Get package version
if: ${{ vars.DEPLOY_TO_TEST_PYPI == 'false' }}
run: |
# when running setup.py outside of pip install, we need to manually install the modules that are imported in the script
pip install setuptools requests cmake-build-extension
version=$(python setup.py --version)
echo "PY_VERSION=${version}" >> $GITHUB_ENV
- name: Create Git tag
if: ${{ vars.DEPLOY_TO_TEST_PYPI == 'false' }}
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.FLEXFLOW_TOKEN }}
custom_tag: ${{ env.PY_VERSION }}