updae env #128
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PyPi Publish | |
on: | |
push: | |
paths-ignore: | |
- 'doc/**' | |
- '**.md' | |
- 'LICENSE' | |
env: | |
IOT_WECOM_CID_ROBOT_KEY: ${{ secrets.IOT_WECOM_CID_ROBOT_KEY }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Install dependencies | |
run: | | |
python setup.py check | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine | |
- name: Unittest TestCase | |
env: | |
PROVISIONING_PASSWORD: ${{ secrets.GPG_DECRYPT_PASSPHRASE }} | |
run: | | |
python -m venv test_env | |
source test_env/bin/activate | |
python setup.py install | |
pip install -r requirements.txt | |
gpg --quiet -d --passphrase "$PROVISIONING_PASSWORD" --batch .github/files/explorer/device_info.json.asc > explorer/sample/device_info.json | |
gpg --quiet -d --passphrase "$PROVISIONING_PASSWORD" --batch .github/files/hub/device_info.json.asc > hub/sample/device_info.json | |
python explorer/sample/test.py | |
python hub/sample/test.py | |
- name: Publish to Test PyPI | |
if: startsWith(github.event.ref, 'refs/heads') | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.IOT_TEST_PYPI_UPLOAD_TOKEN }} | |
run: | | |
python setup.py sdist bdist_wheel | |
twine upload --repository-url https://test.pypi.org/legacy/ dist/* | |
- name: Publish to PyPI | |
if: startsWith(github.event.ref, 'refs/tags') | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.IOT_PYPI_UPLOAD_TOKEN }} | |
run: | | |
VERSION=$(git describe --tags `git rev-list --tags --max-count=1`) | |
echo $VERSION | |
rm -rf dist/ | |
sed -i "s#resp = urllib.request.*#resp = urllib.request.urlopen(f\'https://pypi.org/pypi/{name}/json\')#g" setup.py | |
sed -i "s#version=.*#version=\"$VERSION\",#g" setup.py | |
python setup.py sdist bdist_wheel | |
twine upload dist/* | |
- name: Report success result to wecom | |
if: ${{ success() }} | |
run: | | |
echo success!!! | |
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} success | |
- name: Report fail result to wecom | |
if: ${{ failure() }} | |
run: | | |
echo fail!!! | |
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} fail |