调整了一下yml进行构建和发布[ci][0.2.3]
Some checks failed
CI / docker-ci (push) Failing after 30s

This commit is contained in:
2025-11-26 21:58:10 +08:00
parent f9c0abb3a0
commit 782b2dd82e

View File

@@ -76,22 +76,18 @@ jobs:
echo "$ART" > "$GITHUB_WORKSPACE/.artifact_name"
- name: Upload to Alist
run: |
python3 - << 'PY'
import os,requests,sys
base=os.environ['ALIST_URL'].rstrip('/')
user=os.environ['ALIST_USER']
pwd=os.environ['ALIST_PASSWORD']
ws=os.environ['GITHUB_WORKSPACE']
art=open(os.path.join(ws,'.artifact_name'),'r',encoding='utf-8').read().strip()
fp=os.path.join(ws,art)
r=requests.post(base+'/api/auth/login',json={'username':user,'password':pwd})
tok=(r.json().get('data') or {}).get('token')
if not tok: sys.exit(1)
requests.post(base+'/api/fs/mkdir',json={'path':'/ci'},headers={'Authorization':tok})
files={'file':(art,open(fp,'rb'),'application/x-tar')}
s=requests.put(base+'/api/fs/form',data={'path':'/ci'},files=files,headers={'Authorization':tok})
sys.exit(0 if s.status_code<400 else 1)
PY
ART=$(cat "$GITHUB_WORKSPACE/.artifact_name")
BASE="${ALIST_URL%/}"
LOGIN_RESP=$(curl -sS -X POST "$BASE/api/auth/login" -H "Content-Type: application/json" -d "{\"username\":\"$ALIST_USER\",\"password\":\"$ALIST_PASSWORD\"}")
TOKEN=$(echo "$LOGIN_RESP" | sed -n 's/.*"token":"\([^"]*\)".*/\1/p')
if [ -z "$TOKEN" ]; then TOKEN=$(echo "$LOGIN_RESP" | sed -n 's/.*"auth":"\([^"]*\)".*/\1/p'); fi
if [ -z "$TOKEN" ]; then exit 1; fi
curl -sS -X POST "$BASE/api/fs/mkdir" -H "Authorization: $TOKEN" -H "Content-Type: application/json" -d "{\"path\":\"/ci\"}" >/dev/null 2>&1 || true
UPLOAD_STATUS=$(curl -sS -w "%{http_code}" -o /dev/null -X PUT "$BASE/api/fs/form" -H "Authorization: $TOKEN" -F "path=/ci" -F "file=@$GITHUB_WORKSPACE/$ART;type=application/x-tar")
if [ "$UPLOAD_STATUS" -ge 400 ]; then
UPLOAD_STATUS=$(curl -sS -w "%{http_code}" -o /dev/null -X PUT "$BASE/api/fs/form" -H "Authorization: Bearer $TOKEN" -F "path=/ci" -F "file=@$GITHUB_WORKSPACE/$ART;type=application/x-tar")
fi
test "$UPLOAD_STATUS" -lt 400
- name: Create release with download link
if: env.GITEA_TOKEN != ''
run: |
@@ -99,6 +95,6 @@ jobs:
BRANCH=${GITHUB_REF#refs/heads/}
TAG="$VERSION"
NAME="$VERSION"
DL="$ALIST_URL/ci/$ART"
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"