Files
pyflowx/.github/workflows/release.yml
T
zhou 4b66176ce6
CI / Lint, Typecheck & Test (push) Has been cancelled
~ci.yml
2026-07-02 18:29:03 +08:00

48 lines
1.4 KiB
YAML

name: Release
on:
push:
tags: ['v*.*.*']
permissions:
contents: write
jobs:
release:
name: Build, Publish & Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- uses: actions/setup-python@latest
with:
python-version: '3.13'
- run: uv build
- uses: pypa/gh-action-pypi-publish@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
env:
GITEA_URL: ${{ secrets.GITEA_URL || 'https://git.gookeryoung.cn' }}