48 lines
1.4 KiB
YAML
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: http://gitea:3000/zhou/checkout.git@v4
|
|
|
|
- uses: http://gitea:3000/zhou/setup-uv.git@v8.1.0
|
|
with:
|
|
enable-cache: true
|
|
|
|
- uses: http://gitea:3000/zhou/setup-python.git@v6
|
|
with:
|
|
python-version: '3.13'
|
|
|
|
- run: uv build
|
|
|
|
- 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
|
|
env:
|
|
GITEA_URL: ${{ secrets.GITEA_URL || 'https://git.gookeryoung.cn' }}
|