Skip to content

release: 0.4.10

release: 0.4.10 #12

name: Release Trigger
on:
pull_request:
types: [closed]
branches:
- master
paths:
- 'pai/version.py'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
publish:
name: Release Trigger
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/v')
env:
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
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Check version match
id: check_version
run: |
BRANCH_VERSION=${{ github.head_ref }}
BRANCH_VERSION=${BRANCH_VERSION#releases/v}
FILE_VERSION=$(python -c "from pai.version import VERSION; print(VERSION)")
if [[ "$BRANCH_VERSION" != "$FILE_VERSION" ]]; then
echo "Version in branch name ($BRANCH_VERSION) does not match version in file ($FILE_VERSION)"
exit 1
fi
- name: Get version and create version tag
run: |
VERSION=$(python -c "from pai.version import VERSION; print(VERSION)")
git tag v$VERSION
git push origin v$VERSION
# git tag pushed by GitHub action bot will not trigger another action.
- name: Install dependencies
run: pip install wheel setuptools twine
- name: Build package for pai
run: python setup.py sdist bdist_wheel
- 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