Skip to content

Commit

Permalink
build: support both pai and alipai package release
Browse files Browse the repository at this point in the history
  • Loading branch information
pitt-liang committed Jul 17, 2024
1 parent 067f0f5 commit 9444bde
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
PAI_PYPI_TOKEN: ${{ secrets.PAI_PYPI_TOKEN }}
ALIPAI_PYPI_TOKEN: ${{ secrets.ALIPAI_PYPI_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
Expand All @@ -23,7 +24,18 @@ jobs:
python-version: '3.8'
- name: Install dependencies
run: pip install wheel setuptools twine
- name: Build package
# build and upload package pai
- name: Build package for pai
run: python setup.py sdist bdist_wheel
- name: Publish package to PyPI
run: twine upload dist/* --skip-existing -u __token__ -p $PYPI_TOKEN
- name: Publish package to PyPI (pai)
run: twine upload dist/* --skip-existing -u __token__ -p $PAI_PYPI_TOKEN
- name: cleanup
run: |
rm -rf dist
rm -rf build
rm -rf pai.egg-info
# build and upload package alipai
- name: Build package for alipai
run: PACKAGE_NAME=alipai python setup.py sdist bdist_wheel
- name: Publish package to PyPI (alipai)
run: twine upload dist/* --skip-existing -u __token__ -p $ALIPAI_PYPI_TOKEN
18 changes: 14 additions & 4 deletions .github/workflows/release_trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ jobs:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
PAI_PYPI_TOKEN: ${{ secrets.PAI_PYPI_TOKEN }}
ALIPAI_PYPI_TOKEN: ${{ secrets.ALIPAI_PYPI_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
Expand All @@ -43,7 +44,16 @@ jobs:
# git tag pushed by GitHub action bot will not trigger another action.
- name: Install dependencies
run: pip install wheel setuptools twine
- name: Build package
- name: Build package for pai
run: python setup.py sdist bdist_wheel
- name: Publish package to PyPI
run: twine upload dist/* --skip-existing -u __token__ -p $PYPI_TOKEN
- name: Publish package to PyPI (pai)
run: twine upload dist/* --skip-existing -u __token__ -p $PAI_PYPI_TOKEN
- name: cleanup
run: |
rm -rf dist
rm -rf build
rm -rf pai.egg-info
- name: Build package for alipai
run: PACKAGE_NAME=alipai python setup.py sdist bdist_wheel
- name: Publish package to PyPI (alipai)
run: twine upload dist/* --skip-existing -u __token__ -p $ALIPAI_PYPI_TOKEN
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
pkg_root = os.path.dirname(os.path.abspath(__file__))

REQUIREMENTS_FILE = "requirements/requirements.txt"
PACKAGE_NAME = os.getenv("PACKAGE_NAME", "pai")

version_data = {}
with open(os.path.join(pkg_root, "pai/version.py")) as fp:
Expand All @@ -25,7 +26,7 @@ def read_requirements():
long_description = f.read()

setup(
name="alipai",
name=PACKAGE_NAME,
python_requires=">=3.8",
version=version,
setup_requires=["setuptools_scm"],
Expand Down

0 comments on commit 9444bde

Please sign in to comment.