Files
pyflowx/.github/workflows/release.yml
T
zhou 37ac4b8025
CI / Lint, Typecheck & Test (push) Failing after 1m18s
ci: 为CI和release工作流配置国内PyPI源
添加清华PyPI源配置,加速国内环境下的依赖安装速度
2026-07-04 09:53:35 +08:00

49 lines
1.5 KiB
YAML

name: Release
on:
push:
tags: ['v*.*.*']
permissions:
contents: write
jobs:
release:
name: Build, Publish & Release
runs-on: ubuntu-latest
container:
image: pyflowx-ci:latest
env:
UV_LINK_MODE: copy
# ---- 国内源 ----
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
PIP_TRUSTED_HOST: pypi.tuna.tsinghua.edu.cn
UV_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
UV_TRUSTED_HOST: pypi.tuna.tsinghua.edu.cn
steps:
- uses: http://gitea:3000/zhou/checkout.git@v4
- name: Build distributions
run: uv build
- name: Publish to PyPI
uses: http://gitea:3000/zhou/gh-action-pypi-publish.git@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Create Gitea Release
run: |
VERSION=${GITHUB_REF#refs/tags/v}
REPO=${GITHUB_REPOSITORY}
UPLOAD_URL=$(curl -s -X POST "https://git.gookeryoung.cn/api/v1/repos/${REPO}/releases" \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\": \"v${VERSION}\", \"name\": \"v${VERSION}\", \"draft\": false, \"prerelease\": false}" \
| jq -r '.upload_url')
for file in dist/*; do
curl -s -X POST "${UPLOAD_URL}?name=$(basename $file)" \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
--data-binary @"$file"
done