name: Release on: push: tags: - 'v*' jobs: release: runs-on: ubuntu-latest steps: - name: Checkout code run: | git clone https://gitea.com/${{ github.repository }} ${{ github.workspace }} cd ${{ github.workspace }} git checkout ${{ github.sha }} - name: Build package run: | python3 -m pip install --upgrade pip python3 -m pip install build python3 -m build - name: Create Release run: | TAG_NAME=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD) response=$(curl -s -X POST "https://gitea.com/api/v1/repos/${{ github.repository }}/releases" \ -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ -H "Content-Type: application/json" \ -d '{ "tag_name": "'$TAG_NAME'", "draft": false, "prerelease": false, "body": "Release '$TAG_NAME'" }') RELEASE_ID=$(echo $response | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*') for file in dist/*; do if [ -f "$file" ]; then curl -s -X POST "https://gitea.com/api/v1/repos/${{ github.repository }}/releases/$RELEASE_ID/assets" \ -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ -F "file=@$file" \ -F "name=$(basename $file)" fi done