Fix Gitea release creation: include created_at timestamp to work around Gitea bug where releases get epoch zero timestamp
This commit is contained in:
@@ -219,15 +219,22 @@ create_gitea_release() {
|
|||||||
token=$(cat "$HOME/.gitea_token" | tr -d '\n\r')
|
token=$(cat "$HOME/.gitea_token" | tr -d '\n\r')
|
||||||
local api_url="https://git.laantungir.net/api/v1/repos/laantungir/n_signer"
|
local api_url="https://git.laantungir.net/api/v1/repos/laantungir/n_signer"
|
||||||
|
|
||||||
|
# Include created_at timestamp to work around Gitea bug where releases
|
||||||
|
# created without a timestamp get epoch zero and don't appear in the
|
||||||
|
# releases list or web UI.
|
||||||
|
local now_iso
|
||||||
|
now_iso=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
|
||||||
local response
|
local response
|
||||||
response=$(curl -s -X POST "$api_url/releases" \
|
response=$(curl -s -X POST "$api_url/releases" \
|
||||||
-H "Authorization: token $token" \
|
-H "Authorization: token $token" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"tag_name\": \"$NEW_VERSION\", \"name\": \"$NEW_VERSION\", \"body\": \"$COMMIT_MESSAGE\"}")
|
-d "{\"tag_name\": \"$NEW_VERSION\", \"target_commitish\": \"master\", \"name\": \"$NEW_VERSION\", \"body\": \"$COMMIT_MESSAGE\", \"draft\": false, \"prerelease\": false, \"created_at\": \"$now_iso\"}")
|
||||||
|
|
||||||
if echo "$response" | grep -q '"id"'; then
|
if echo "$response" | grep -q '"id"'; then
|
||||||
echo "$response" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2
|
echo "$response" | grep -o '"id":[0-9]*' | head -1 | cut -d':' -f2
|
||||||
else
|
else
|
||||||
|
print_error "Failed to create Gitea release: $response"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -757,8 +757,8 @@ int socket_name_random(char *out, size_t out_len);
|
|||||||
/* Version information (auto-updated by build/version tooling) */
|
/* Version information (auto-updated by build/version tooling) */
|
||||||
#define NSIGNER_VERSION_MAJOR 0
|
#define NSIGNER_VERSION_MAJOR 0
|
||||||
#define NSIGNER_VERSION_MINOR 0
|
#define NSIGNER_VERSION_MINOR 0
|
||||||
#define NSIGNER_VERSION_PATCH 47
|
#define NSIGNER_VERSION_PATCH 45
|
||||||
#define NSIGNER_VERSION "v0.0.47"
|
#define NSIGNER_VERSION "v0.0.45"
|
||||||
|
|
||||||
|
|
||||||
/* NSIGNER_HEADERLESS_DECLS_END */
|
/* NSIGNER_HEADERLESS_DECLS_END */
|
||||||
|
|||||||
Reference in New Issue
Block a user