mirror of
https://gitea.com/gitea/docs.git
synced 2026-09-17 19:55:34 +00:00
update api docs (#297)
script is now standalone instead of being CI only. Added a post 1.25 rule for templates since the variables in template changed after https://gitea.com/gitea/gitea-mirror/commit/3533263ced8 Fixes: https://github.com/go-gitea/gitea/issues/35964 Co-authored-by: Lunny Xiao <[email protected]> Reviewed-on: https://gitea.com/gitea/docs/pulls/297 Reviewed-by: Lunny Xiao <[email protected]> Co-authored-by: TheFox0x7 <[email protected]> Co-committed-by: TheFox0x7 <[email protected]>
This commit is contained in:
committed by
Lunny Xiao
co-authored by
Lunny Xiao
parent
826ff60fd4
commit
e3cc4ec689
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
curl --silent --output v1_json.tmpl https://raw.githubusercontent.com/go-gitea/gitea/refs/heads/main/templates/swagger/v1_json.tmpl
|
||||
sed -i "$@" 's|"version": "{{.SwaggerAppVer}}"|"version": "dev"|' v1_json.tmpl
|
||||
sed -i "$@" 's|"basePath": "{{.SwaggerAppSubUrl}}/api/v1"|"basePath": "https://gitea.com/api/v1"|' v1_json.tmpl
|
||||
mv v1_json.tmpl static/swagger-latest.json
|
||||
|
||||
for ver in '1.25.1' '1.24.7' '1.23.8' '1.22.6'; do
|
||||
curl --silent --output v1_json.tmpl https://raw.githubusercontent.com/go-gitea/gitea/refs/tags/v${ver}/templates/swagger/v1_json.tmpl
|
||||
sed -i "$@" "s|\"version\": \"{{.SwaggerAppVer}}\"|\"version\": \"${ver}\"|" v1_json.tmpl
|
||||
sed -i "$@" 's|"basePath": "{{.SwaggerAppSubUrl}}/api/v1"|"basePath": "https://gitea.com/api/v1"|' v1_json.tmpl
|
||||
# for versions < 1.24
|
||||
sed -i "$@" "s|\"version\": \"{{AppVer \| JSEscape}}\"|\"version\": \"${ver}\"|" v1_json.tmpl
|
||||
sed -i "$@" 's\"basePath": "{{AppSubUrl | JSEscape}}/api/v1"\"basePath": "https://gitea.com/api/v1"\' v1_json.tmpl
|
||||
minor=$(echo "$ver" | cut -d '.' -f 2)
|
||||
mv v1_json.tmpl static/swagger-$minor.json
|
||||
done
|
||||
Reference in New Issue
Block a user