This commit is contained in:
@@ -48,11 +48,36 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Publish Gitea Release
|
- name: Publish Gitea Release
|
||||||
uses: https://gitea.com/actions/release-action@main
|
env:
|
||||||
with:
|
TOKEN: ${{ secrets.GITEA_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
api_key: ${{ secrets.GITEA_TOKEN || secrets.GITHUB_TOKEN }}
|
TAG: ${{ steps.tag.outputs.name }}
|
||||||
tag: ${{ steps.tag.outputs.name }}
|
run: |
|
||||||
title: ${{ steps.tag.outputs.name }}
|
set -eu
|
||||||
files: |-
|
API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases"
|
||||||
release/app.mjs
|
parse_id='let d="";process.stdin.on("data",c=>d+=c).on("end",()=>{try{process.stdout.write(String(JSON.parse(d).id||""))}catch(e){}})'
|
||||||
release/install.sh
|
|
||||||
|
rid=$(curl -sS -X POST "$API" \
|
||||||
|
-H "Authorization: token $TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"draft\":false,\"prerelease\":false}" \
|
||||||
|
| node -e "$parse_id")
|
||||||
|
|
||||||
|
if [ -z "$rid" ]; then
|
||||||
|
echo "release may already exist, fetching by tag $TAG"
|
||||||
|
rid=$(curl -sS "$API/tags/$TAG" -H "Authorization: token $TOKEN" | node -e "$parse_id")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$rid" ]; then
|
||||||
|
echo "failed to create or find release for $TAG" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "release id=$rid"
|
||||||
|
|
||||||
|
for f in release/app.mjs release/install.sh; do
|
||||||
|
name=$(basename "$f")
|
||||||
|
echo "uploading $name"
|
||||||
|
curl -sS -X POST "$API/$rid/assets?name=$name" \
|
||||||
|
-H "Authorization: token $TOKEN" \
|
||||||
|
-F "attachment=@$f" \
|
||||||
|
-o /dev/null -w " -> HTTP %{http_code}\n"
|
||||||
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user