name: Publish Python Package to Gitea on: push: branches: - main jobs: publish: runs-on: ubuntu-latest defaults: run: shell: bash env: PIP_BREAK_SYSTEM_PACKAGES: "1" PATH: /usr/local/bin:/usr/local/python3.12/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple PIP_EXTRA_INDEX_URL: https://mirrors.aliyun.com/pypi/simple https://mirrors.cloud.tencent.com/pypi/simple https://mirrors.huaweicloud.com/repository/pypi/simple PIP_DEFAULT_TIMEOUT: "180" PIP_TRUSTED_HOST: pypi.tuna.tsinghua.edu.cn mirrors.aliyun.com mirrors.cloud.tencent.com mirrors.huaweicloud.com files.pythonhosted.org pypi.org steps: - uses: https://git.jc2009.com/admin/actions-checkout@v4 - name: Resolve and patch package version env: GITHUB_REF: ${{ github.ref }} GITHUB_RUN_NUMBER: ${{ github.run_number }} GITHUB_RUN_ID: ${{ github.run_id }} run: python3.12 tools/ci_set_package_version.py - name: Install build tools run: python3.12 -m pip install --upgrade build twine --break-system-packages - name: Build distributions run: python3.12 -m build - name: Publish to Gitea Package Registry env: TWINE_USERNAME: admin TWINE_PASSWORD: ${{ secrets.PACKAGE_TOKEN }} run: | python3.12 -m twine upload \ --repository-url https://git.jc2009.com/api/packages/client-jiangchang/pypi \ dist/*