Merge pull request 'release v0.1.3: bump version, fix publish auth across http->https redirect' (#3) from v0.1.3-final into main
This commit was merged in pull request #3.
This commit is contained in:
@@ -83,17 +83,19 @@ jobs:
|
|||||||
tar_file=$(ls plugin/dist/*.tar.gz | head -n 1)
|
tar_file=$(ls plugin/dist/*.tar.gz | head -n 1)
|
||||||
api_url="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
api_url="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
||||||
|
|
||||||
# server_url may be http while Gitea redirects (308) to https:
|
# server_url is http and Gitea answers with a 308 redirect to https.
|
||||||
# curl needs -L or the POST returns an empty body. Release may also
|
# curl needs -L to follow, AND --location-trusted: without it curl
|
||||||
# already exist (retried run) — reuse it instead of failing.
|
# drops the Authorization header on the scheme-changing redirect and
|
||||||
|
# Gitea replies "token is required". Release may already exist
|
||||||
|
# (retried run) — reuse it instead of failing.
|
||||||
fetch_id() { python3 -c "import json,sys;print(json.load(sys.stdin).get('id') or '')" 2>/dev/null; }
|
fetch_id() { python3 -c "import json,sys;print(json.load(sys.stdin).get('id') or '')" 2>/dev/null; }
|
||||||
|
|
||||||
response=$(curl -s -k -L -H "Authorization: token $GITEA_TOKEN" \
|
response=$(curl -s -k -L --location-trusted -H "Authorization: token $GITEA_TOKEN" \
|
||||||
"$api_url/releases/tags/$tag_name")
|
"$api_url/releases/tags/$tag_name")
|
||||||
release_id=$(printf '%s' "$response" | fetch_id)
|
release_id=$(printf '%s' "$response" | fetch_id)
|
||||||
|
|
||||||
if [ -z "$release_id" ]; then
|
if [ -z "$release_id" ]; then
|
||||||
response=$(curl -s -k -L -X POST "$api_url/releases" \
|
response=$(curl -s -k -L --location-trusted -X POST "$api_url/releases" \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"tag_name\": \"$tag_name\", \"name\": \"$tag_name\", \"body\": \"Release $tag_name for hermes-meshtastic plugin\"}")
|
-d "{\"tag_name\": \"$tag_name\", \"name\": \"$tag_name\", \"body\": \"Release $tag_name for hermes-meshtastic plugin\"}")
|
||||||
@@ -101,11 +103,11 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$release_id" ]; then
|
if [ -n "$release_id" ]; then
|
||||||
curl -s -k -L -X POST "$api_url/releases/$release_id/assets?name=$(basename "$wheel_file")" \
|
curl -s -k -L --location-trusted -X POST "$api_url/releases/$release_id/assets?name=$(basename "$wheel_file")" \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
--data-binary "@$wheel_file"
|
--data-binary "@$wheel_file"
|
||||||
curl -s -k -L -X POST "$api_url/releases/$release_id/assets?name=$(basename "$tar_file")" \
|
curl -s -k -L --location-trusted -X POST "$api_url/releases/$release_id/assets?name=$(basename "$tar_file")" \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
--data-binary "@$tar_file"
|
--data-binary "@$tar_file"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "hermes-meshtastic"
|
name = "hermes-meshtastic"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
description = "Meshtastic LoRa mesh gateway adapter plugin for Hermes Agent"
|
description = "Meshtastic LoRa mesh gateway adapter plugin for Hermes Agent"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
|
|||||||
Reference in New Issue
Block a user