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