This commit is contained in:
@@ -29,7 +29,7 @@ jobs:
|
||||
ALIST_PASSWORD: ${{ secrets.ALIST_PASSWORD }}
|
||||
GITEA_SERVER: ${{ github.server_url }}
|
||||
GITEA_REPO: ${{ github.repository }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
RELEASE_TOKEN: ${{ secrets.token }}
|
||||
steps:
|
||||
- name: Ensure source present
|
||||
env:
|
||||
@@ -85,15 +85,10 @@ jobs:
|
||||
cat "$GITHUB_WORKSPACE/login.json"
|
||||
exit 1
|
||||
fi
|
||||
TOKEN=$(python3 - << 'PY'
|
||||
import json,sys,os
|
||||
p=os.path.join(os.environ['GITHUB_WORKSPACE'],'login.json')
|
||||
with open(p,'rb') as f:
|
||||
j=json.load(f)
|
||||
d=j.get('data') or {}
|
||||
print(d.get('token') or d.get('auth') or '')
|
||||
PY
|
||||
)
|
||||
TOKEN=$(sed -n 's/.*"token":"\([^"]*\)".*/\1/p' "$GITHUB_WORKSPACE/login.json")
|
||||
if [ -z "$TOKEN" ]; then
|
||||
TOKEN=$(sed -n 's/.*"auth":"\([^"]*\)".*/\1/p' "$GITHUB_WORKSPACE/login.json")
|
||||
fi
|
||||
if [ -z "$TOKEN" ]; then
|
||||
echo token_not_found
|
||||
cat "$GITHUB_WORKSPACE/login.json"
|
||||
@@ -109,7 +104,7 @@ PY
|
||||
exit 1
|
||||
fi
|
||||
- name: Create release with download link
|
||||
if: env.GITEA_TOKEN != ''
|
||||
if: env.RELEASE_TOKEN != ''
|
||||
run: |
|
||||
ART=$(cat "$GITHUB_WORKSPACE/.artifact_name")
|
||||
BRANCH=${GITHUB_REF#refs/heads/}
|
||||
@@ -117,4 +112,4 @@ PY
|
||||
NAME="$VERSION"
|
||||
DL="${ALIST_URL%/}/ci/$ART"
|
||||
JSON=$(printf '{"tag_name":"%s","target_commitish":"%s","name":"%s","body":"%s"}' "$TAG" "$BRANCH" "$NAME" "$DL")
|
||||
curl -sS -X POST "$GITEA_SERVER/api/v1/repos/$GITEA_REPO/releases" -H "Content-Type: application/json" -H "Authorization: token $GITEA_TOKEN" -d "$JSON"
|
||||
curl -sS -X POST "$GITEA_SERVER/api/v1/repos/$GITEA_REPO/releases" -H "Content-Type: application/json" -H "Authorization: token $RELEASE_TOKEN" -d "$JSON"
|
||||
|
||||
Reference in New Issue
Block a user