Fix PowerShell env var: TOKEN -> env:TOKEN
This commit is contained in:
@@ -48,11 +48,11 @@ jobs:
|
|||||||
|
|
||||||
# Get or create the latest release
|
# Get or create the latest release
|
||||||
$release = Invoke-RestMethod -Uri "$env:GITEA_URL/api/v1/repos/$env:REPO/releases/tags/latest" `
|
$release = Invoke-RestMethod -Uri "$env:GITEA_URL/api/v1/repos/$env:REPO/releases/tags/latest" `
|
||||||
-Headers @{ Authorization = "token $TOKEN" } -ErrorAction SilentlyContinue
|
-Headers @{ Authorization = "token $env:TOKEN" } -ErrorAction SilentlyContinue
|
||||||
if (-not $release) {
|
if (-not $release) {
|
||||||
$release = Invoke-RestMethod -Uri "$env:GITEA_URL/api/v1/repos/$env:REPO/releases" `
|
$release = Invoke-RestMethod -Uri "$env:GITEA_URL/api/v1/repos/$env:REPO/releases" `
|
||||||
-Method Post `
|
-Method Post `
|
||||||
-Headers @{ Authorization = "token $TOKEN"; "Content-Type" = "application/json" } `
|
-Headers @{ Authorization = "token $env:TOKEN"; "Content-Type" = "application/json" } `
|
||||||
-Body "{`"tag_name`":`"latest`",`"name`":`"Lotus Chat $VERSION`",`"prerelease`":true,`"body`":`"Built from ${{ github.sha }}`"}"
|
-Body "{`"tag_name`":`"latest`",`"name`":`"Lotus Chat $VERSION`",`"prerelease`":true,`"body`":`"Built from ${{ github.sha }}`"}"
|
||||||
}
|
}
|
||||||
$releaseId = $release.id
|
$releaseId = $release.id
|
||||||
@@ -68,7 +68,7 @@ jobs:
|
|||||||
$bytes = [System.IO.File]::ReadAllBytes($files[$i])
|
$bytes = [System.IO.File]::ReadAllBytes($files[$i])
|
||||||
Invoke-RestMethod -Uri "$env:GITEA_URL/api/v1/repos/$env:REPO/releases/$releaseId/assets?name=$($names[$i])" `
|
Invoke-RestMethod -Uri "$env:GITEA_URL/api/v1/repos/$env:REPO/releases/$releaseId/assets?name=$($names[$i])" `
|
||||||
-Method Post `
|
-Method Post `
|
||||||
-Headers @{ Authorization = "token $TOKEN"; "Content-Type" = "application/octet-stream" } `
|
-Headers @{ Authorization = "token $env:TOKEN"; "Content-Type" = "application/octet-stream" } `
|
||||||
-Body $bytes
|
-Body $bytes
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,11 +122,11 @@ jobs:
|
|||||||
VERSION=$(python3 -c "import json; print(json.load(open('src-tauri/tauri.conf.json'))['version'])")
|
VERSION=$(python3 -c "import json; print(json.load(open('src-tauri/tauri.conf.json'))['version'])")
|
||||||
# Get or create the latest release
|
# Get or create the latest release
|
||||||
RELEASE=$(curl -sf "$GITEA_URL/api/v1/repos/$REPO/releases/tags/latest" \
|
RELEASE=$(curl -sf "$GITEA_URL/api/v1/repos/$REPO/releases/tags/latest" \
|
||||||
-H "Authorization: token $TOKEN" 2>/dev/null || true)
|
-H "Authorization: token $env:TOKEN" 2>/dev/null || true)
|
||||||
RELEASE_ID=$(echo "$RELEASE" | python3 -c "import sys,json; print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true)
|
RELEASE_ID=$(echo "$RELEASE" | python3 -c "import sys,json; print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true)
|
||||||
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "None" ]; then
|
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "None" ]; then
|
||||||
RELEASE_ID=$(curl -sf -X POST "$GITEA_URL/api/v1/repos/$REPO/releases" \
|
RELEASE_ID=$(curl -sf -X POST "$GITEA_URL/api/v1/repos/$REPO/releases" \
|
||||||
-H "Authorization: token $TOKEN" \
|
-H "Authorization: token $env:TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"tag_name\":\"latest\",\"name\":\"Lotus Chat $VERSION\",\"prerelease\":true,\"body\":\"Built from ${{ github.sha }}\"}" \
|
-d "{\"tag_name\":\"latest\",\"name\":\"Lotus Chat $VERSION\",\"prerelease\":true,\"body\":\"Built from ${{ github.sha }}\"}" \
|
||||||
| python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
|
| python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
|
||||||
@@ -144,7 +144,7 @@ jobs:
|
|||||||
echo "Uploading $name"
|
echo "Uploading $name"
|
||||||
curl -sf -X POST \
|
curl -sf -X POST \
|
||||||
"$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets?name=$name" \
|
"$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets?name=$name" \
|
||||||
-H "Authorization: token $TOKEN" \
|
-H "Authorization: token $env:TOKEN" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
--data-binary @"${uploads[$name]}"
|
--data-binary @"${uploads[$name]}"
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user