Skip to content

Commit 67262c4

Browse files
committed
Release:--: v0.0.8_2026-04-28_12:18:18_UTC
1 parent ba7883c commit 67262c4

6 files changed

Lines changed: 86 additions & 112 deletions

File tree

ac_config/ac_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
const (
1818
ProjectName = "api_show"
19-
ProjectVersion = "v0.0.7"
19+
ProjectVersion = "v0.0.8"
2020
ProjectBundleID = "com.0xYeah.api_show"
2121

2222
ListenPort = 12110

build.sh

Lines changed: 62 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11
#!/bin/bash
2-
# build.sh — local + CI build entrypoint for api_show.
3-
#
4-
# Produces:
5-
# build/<mode>/<product_name>/<product_name> (binary)
6-
# build/<mode>/<product_name>/conf/ (optional configs)
7-
# build/upload_tmp_dir/<product_name>_<os>_<mode>_<version>.zip
8-
#
9-
# Modes:
10-
# ./build.sh → release (default)
11-
# ./build.sh test → test
12-
# ./build.sh debug → debug
13-
#
14-
# api_show ships as a single binary; no extend-app submodules.
15-
162
set -e
173

184
product_name=$(grep ProjectName ./ac_config/ac_config.go | awk -F '"' '{print $2}' | sed 's/\"//g')
@@ -22,82 +8,102 @@ CURRENT_VERSION=$(grep ${Product_version_key} $VersionFile | awk -F '"' '{print
228

239
build_path=./build
2410
RUN_MODE=release
11+
2512
UPLOAD_TMP_DIR=upload_tmp_dir
2613

14+
extend_app_names=()
15+
2716
OS_TYPE="Unknown"
2817
GetOSType(){
29-
uNames=$(uname -s)
18+
uNames=`uname -s`
3019
osName=${uNames: 0: 4}
31-
case "$osName" in
32-
Darw) OS_TYPE="Darwin" ;;
33-
Linu) OS_TYPE="Linux" ;;
34-
MING) OS_TYPE="Windows" ;;
35-
*) OS_TYPE="Unknown" ;;
36-
esac
20+
if [ "$osName" == "Darw" ] # Darwin
21+
then
22+
OS_TYPE="Darwin"
23+
elif [ "$osName" == "Linu" ] # Linux
24+
then
25+
OS_TYPE="Linux"
26+
elif [ "$osName" == "MING" ] # MINGW, windows, git-bash
27+
then
28+
OS_TYPE="Windows"
29+
else
30+
OS_TYPE="Unknown"
31+
fi
3732
}
3833
GetOSType
3934

4035
function toBuild() {
41-
rm -rf "${build_path}/${RUN_MODE}"
42-
mkdir -p "${build_path}/${RUN_MODE}"
36+
37+
rm -rf ${build_path}/${RUN_MODE}
38+
mkdir -p ${build_path}/${RUN_MODE}
4339

4440
go_version=$(go version | awk '{print $3}')
4541
commit_hash=$(git show -s --format=%H)
4642
commit_date=$(git show -s --format="%ci")
4743

4844
if [[ "$OS_TYPE" == "Darwin" ]]; then
45+
# macOS
4946
formatted_time=$(date -u -j -f "%Y-%m-%d %H:%M:%S %z" "${commit_date}" "+%Y-%m-%d_%H:%M:%S")
5047
else
48+
# Linux
5149
formatted_time=$(date -u -d "${commit_date}" "+%Y-%m-%d_%H:%M:%S")
5250
fi
5351

5452
build_time=$(date +"%Y-%m-%d_%H:%M:%S")
5553

5654
ld_flag_master="-X main.mGitCommitHash=${commit_hash} -X main.mGitCommitTime=${formatted_time} -X main.mGoVersion=${go_version} -X main.mPackageOS=${OS_TYPE} -X main.mPackageTime=${build_time} -X main.mRunMode=${RUN_MODE} -s -w"
5755

58-
out_dir="${build_path}/${RUN_MODE}/${product_name}"
59-
mkdir -p "${out_dir}/conf"
56+
echo "build ${product_name}"
57+
go build -o "${build_path}/${RUN_MODE}/${product_name}/${product_name}" -trimpath -ldflags "${ld_flag_master}" main.go
58+
chmod a+x "${build_path}/${RUN_MODE}/${product_name}/${product_name}"
59+
[[ -f "./example_files/${product_name}.service" ]] && cp "./example_files/${product_name}.service" "${build_path}/${RUN_MODE}/${product_name}/"
60+
[[ -f "./example_files/install_${product_name}.sh" ]] && cp "./example_files/install_${product_name}.sh" "${build_path}/${RUN_MODE}/${product_name}/install_${product_name}.sh"
61+
mkdir -p "${build_path}/${RUN_MODE}/${product_name}/conf"
62+
[[ -f "./example_files/config_example.yaml" ]] && cp "./example_files/config_example.yaml" "${build_path}/${RUN_MODE}/${product_name}/conf/config.yaml"
6063

61-
echo "[build] compiling ${product_name} ${CURRENT_VERSION} (${OS_TYPE}/${RUN_MODE})"
62-
go build -o "${out_dir}/${product_name}" -trimpath -ldflags "${ld_flag_master}" .
63-
chmod a+x "${out_dir}/${product_name}"
6464

65-
# Bundle example_files/ — service + installer + optional nginx.
66-
# config.toml is NOT shipped — binary auto-creates ${APP_DIR}/conf/api_show_config.toml
67-
# on first start via SyncConfigFile (mirrors certa_ame pattern).
68-
[[ -f "./example_files/${product_name}.service" ]] && cp "./example_files/${product_name}.service" "${out_dir}/"
69-
[[ -f "./example_files/install_${product_name}.sh" ]] && cp "./example_files/install_${product_name}.sh" "${out_dir}/install_${product_name}.sh"
70-
[[ -f "./example_files/nginx.conf" ]] && cp "./example_files/nginx.conf" "${out_dir}/conf/nginx.conf"
65+
for extend_app in "${extend_app_names[@]}"; do
66+
go build -o ${build_path}/${RUN_MODE}/${product_name}_${extend_app}/${product_name}_${extend_app} -trimpath -ldflags "${ld_flag_master}" ./${product_name}_${extend_app}/main.go \
67+
&& chmod a+x ${build_path}/${RUN_MODE}/${product_name}_${extend_app}/${product_name}_${extend_app} \
68+
&& cp ./example_files/${product_name}_${extend_app}.service ${build_path}/${RUN_MODE}/${product_name}_${extend_app} \
69+
&& cp ./example_files/install_${product_name}_${extend_app}.sh ${build_path}/${RUN_MODE}/${product_name}_${extend_app}/install_${product_name}_${extend_app}.sh \
70+
&& mkdir -p ${build_path}/${RUN_MODE}/${product_name}_${extend_app}/conf \
71+
&& cp ./example_files/config_${extend_app}_example.yaml ${build_path}/${RUN_MODE}/${product_name}_${extend_app}/conf/config_${extend_app}.yaml
72+
done
7173

7274
package_files
7375
}
7476

75-
function package_files() {
76-
local OS_TYPE_LOWER
77-
OS_TYPE_LOWER=$(echo "${OS_TYPE}" | awk '{print tolower($0)}')
78-
cd "${build_path}/${RUN_MODE}"
79-
if [[ "$OS_TYPE" == "Windows" ]]; then
80-
7z a "./${product_name}_${OS_TYPE_LOWER}_${RUN_MODE}_${CURRENT_VERSION}.zip" "./${product_name}" >/dev/null 2>&1
81-
else
82-
zip -r "./${product_name}_${OS_TYPE_LOWER}_${RUN_MODE}_${CURRENT_VERSION}.zip" "./${product_name}"
83-
fi
84-
mkdir -p "../${UPLOAD_TMP_DIR}"
85-
mv ./*.zip "../${UPLOAD_TMP_DIR}/"
86-
cd ../
77+
function package_files(){
78+
local OS_TYPE_LOWER=$(echo "${OS_TYPE}" | awk '{print tolower($0)}')
79+
cd ${build_path}/${RUN_MODE} \
80+
&& if [[ "$OS_TYPE" == "Windows" ]]; then
81+
7z a ./${product_name}_${OS_TYPE_LOWER}_${RUN_MODE}_${CURRENT_VERSION}.zip ./${product_name} >/dev/null 2>&1
82+
else
83+
zip -r ./${product_name}_${OS_TYPE_LOWER}_${RUN_MODE}_${CURRENT_VERSION}.zip ./${product_name}
84+
for extend_app in "${extend_app_names[@]}"; do
85+
zip -r ./${product_name}_${extend_app}_${OS_TYPE_LOWER}_${RUN_MODE}_${CURRENT_VERSION}.zip ./${product_name}_${extend_app}
86+
done
87+
fi \
88+
&& mkdir -p ../${UPLOAD_TMP_DIR} \
89+
&& mv *.zip ../${UPLOAD_TMP_DIR} \
90+
&& cd ../
8791
}
8892

93+
8994
function handlerunMode() {
90-
case "$1" in
91-
release|"") RUN_MODE=release ;;
92-
test) RUN_MODE=test ;;
93-
debug) RUN_MODE=debug ;;
94-
*)
95-
echo "Usage: bash build.sh [release|test|debug] (default: release)"
96-
exit 0
97-
;;
98-
esac
95+
if [[ "$1" == "release" || "$1" == "" ]]; then
96+
RUN_MODE=release
97+
elif [[ "$1" == "test" ]]; then
98+
RUN_MODE=test
99+
elif [[ "$1" == "debug" ]]; then
100+
RUN_MODE=debug
101+
else
102+
echo "Usage: bash build.sh [release|test],default with:release"
103+
exit 0
104+
fi
99105
}
100106

107+
101108
handlerunMode "$1" && toBuild
102109

103-
echo "[build] OK: ${product_name} ${CURRENT_VERSION}${build_path}/${UPLOAD_TMP_DIR}/${product_name}_$(echo "${OS_TYPE}" | awk '{print tolower($0)}')_${RUN_MODE}_${CURRENT_VERSION}.zip"

changelog/v0.0.6.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

changelog/v0.0.8.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## v0.0.8 ChangeLog
2+
3+
- Release:--: v0.0.8_2026-04-28_12:18:18_UTC
4+
- Range: ba7883c31e2756f69b3a9858d60e7f307eafc95d..HEAD
5+
- Commits: 0
6+
7+
### commit infos
8+
9+
- (no commits between releases)
10+
- (no file changes)
11+
12+
### commit messages
13+
14+
- (no commits between releases)
15+

example_files/nginx.conf

Lines changed: 0 additions & 27 deletions
This file was deleted.

git_tag.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ function find_prev_release_commit() {
111111
}
112112

113113
function gen_changelog_if_possible() {
114+
local del_version_no="$1"
114115
local out_dir out_file prev_release_sha range_end range
115116
out_dir="changelog"
116117
mkdir -p "${out_dir}"
@@ -197,8 +198,13 @@ function git_handle_push() {
197198
local pre_del_version_no=$(get_pre_del_version_no "$current_version_no")
198199
echo "Pre Del Version With v"${pre_del_version_no}
199200

200-
gen_changelog_if_possible \
201-
&& rm -rf changelog/v${pre_del_version_no}.md \
201+
# Standalone health gate (B): refuse to cut an aggregation tag if any
202+
# submodule fails to build/tidy cleanly without go.work support.
203+
if [ -x ./scripts/check_standalone.sh ]; then
204+
./scripts/check_standalone.sh
205+
fi
206+
207+
gen_changelog_if_possible "${pre_del_version_no}" \
202208
&& git add . \
203209
&& git commit -m "Release:--: v${next_version_no}_$(date -u +"%Y-%m-%d_%H:%M:%S")"_"UTC" \
204210
&& git tag v${next_version_no} \

0 commit comments

Comments
 (0)