Use RELEASE_TOKEN secret for releases
This commit is contained in:
@@ -43,11 +43,11 @@ jobs:
|
||||
|
||||
- name: Upload release assets
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "${GITEA_TOKEN:-}" ]; then
|
||||
echo "GITEA_TOKEN secret is required to upload release assets."
|
||||
if [ -z "${RELEASE_TOKEN:-}" ]; then
|
||||
echo "RELEASE_TOKEN secret is required to upload release assets."
|
||||
exit 1
|
||||
fi
|
||||
TAG="${GITHUB_REF_NAME:-${GITEA_REF_NAME:-unknown}}"
|
||||
@@ -57,7 +57,7 @@ jobs:
|
||||
fi
|
||||
REPO="${GITHUB_REPOSITORY}"
|
||||
|
||||
release_json=$(curl -sS -H "Authorization: token ${GITEA_TOKEN}" \
|
||||
release_json=$(curl -sS -H "Authorization: token ${RELEASE_TOKEN}" \
|
||||
"${API_URL}/repos/${REPO}/releases/tags/${TAG}")
|
||||
release_id=$(python3 - <<'PY'
|
||||
import json, sys
|
||||
@@ -76,7 +76,7 @@ print(json.dumps({
|
||||
}))
|
||||
PY
|
||||
)
|
||||
release_json=$(curl -sS -H "Authorization: token ${GITEA_TOKEN}" \
|
||||
release_json=$(curl -sS -H "Authorization: token ${RELEASE_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$create_payload" \
|
||||
"${API_URL}/repos/${REPO}/releases")
|
||||
@@ -90,7 +90,7 @@ PY
|
||||
|
||||
for file in dist/*.tar.gz; do
|
||||
name=$(basename "$file")
|
||||
curl -sS -H "Authorization: token ${GITEA_TOKEN}" \
|
||||
curl -sS -H "Authorization: token ${RELEASE_TOKEN}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"$file" \
|
||||
"${API_URL}/repos/${REPO}/releases/${release_id}/assets?name=${name}"
|
||||
|
||||
@@ -5,7 +5,7 @@ This repo includes a Gitea Actions workflow that builds Linux binaries for
|
||||
|
||||
## One-time setup (Gitea Actions)
|
||||
1) Create a personal access token with repo write access.
|
||||
2) Add it to the repo secrets as `GITEA_TOKEN`.
|
||||
2) Add it to the repo secrets as `RELEASE_TOKEN`.
|
||||
|
||||
## Release steps
|
||||
1) Update `CHANGELOG.md`.
|
||||
|
||||
Reference in New Issue
Block a user