Files
pyflowx/.github/workflows/release.yml
T
zhou dbd30689ab chore(ci): 更新release工作流的gitea服务地址
将GITEA_URL从10.0.16.16:3000调整为172.17.0.1:3000,适配新的内网部署地址
2026-07-04 11:36:04 +08:00

59 lines
1.9 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
run: uv publish --token '${{ secrets.PYPI_TOKEN }}'
- name: Create Gitea Release & Upload Assets
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
REPO: ${{ github.repository }}
GITEA_URL: http://172.17.0.1:3000
run: |
set -e
# 1. 创建 Release
RELEASE_ID=$(curl -sS -X POST "$GITEA_URL/api/v1/repos/$REPO/releases" \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG_NAME\",\"name\":\"Release $TAG_NAME\",\"body\":\"Automated release from CI\",\"draft\":false,\"prerelease\":false}" \
| python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
echo "Created release id=$RELEASE_ID"
# 2. 上传 dist/ 下所有文件作为附件
for f in dist/*; do
echo "Uploading $f ..."
curl -sS -X POST "$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets?name=$(basename $f)" \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$f"
done