ci: broaden release asset upload token fallback
All checks were successful
Android build / build (push) Successful in 8m8s
All checks were successful
Android build / build (push) Successful in 8m8s
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
name: Android build
|
name: Android build
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: write
|
||||||
releases: write
|
releases: write
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -161,13 +161,19 @@ jobs:
|
|||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
token="${GITEA_TOKEN:-${GITHUB_TOKEN:-}}"
|
||||||
|
if [ -z "$token" ]; then
|
||||||
|
echo "::error::No release upload token is available from secrets.GITEA_TOKEN or github.token"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
release_id="$(python3 -c 'import json, os; print(json.load(open(os.environ["GITHUB_EVENT_PATH"], encoding="utf-8"))["release"]["id"])')"
|
release_id="$(python3 -c 'import json, os; print(json.load(open(os.environ["GITHUB_EVENT_PATH"], encoding="utf-8"))["release"]["id"])')"
|
||||||
aab="${{ steps.release_aab.outputs.path }}"
|
aab="${{ steps.release_aab.outputs.path }}"
|
||||||
curl --fail-with-body \
|
curl --fail-with-body \
|
||||||
--request POST \
|
--request POST \
|
||||||
--header "Authorization: token ***" \
|
--header "Authorization: token ${token}" \
|
||||||
--form "attachment=@${aab}" \
|
--form "attachment=@${aab}" \
|
||||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=$(basename "$aab")"
|
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=$(basename "$aab")"
|
||||||
|
|||||||
Reference in New Issue
Block a user