Feat: new build config

pull/194/head
zijiren233 9 months ago
parent 466dec7cf7
commit dc0a5877a4

@ -26,7 +26,7 @@ jobs:
declare -a arr=()
OIFS="$IFS"
IFS=$'\n,'
for line in $(script/build.sh -t); do
for line in $(BUILD_CONFIG=script/build.config.sh bash script/build.sh --show-all-targets); do
arr+=("$line")
done
IFS="$OIFS"
@ -52,4 +52,4 @@ jobs:
- name: Build
run: |
bash script/build.sh -sp "${{ matrix.target }}" -m '-a -v -x'
BUILD_CONFIG=script/build.config.sh bash script/build.sh --skip-init-web --platforms="${{ matrix.target }}" --more-go-cmd-args='-a -v -x'

@ -21,7 +21,7 @@ jobs:
declare -a arr=()
OIFS="$IFS"
IFS=$'\n,'
for line in $(script/build.sh -t); do
for line in $(BUILD_CONFIG=script/build.config.sh bash script/build.sh --show-all-targets); do
arr+=("$line")
done
IFS="$OIFS"
@ -51,7 +51,7 @@ jobs:
- name: Build
run: |
bash script/build.sh -v "v${{ steps.get_version.outputs.VERSION }}" -p "${{ matrix.target }}" -m '-a -v'
BUILD_CONFIG=script/build.config.sh bash script/build.sh --version="v${{ steps.get_version.outputs.VERSION }}" --platforms="${{ matrix.target }}" --more-go-cmd-args='-a -v'
- name: Release
uses: softprops/action-gh-release@v2
@ -64,4 +64,4 @@ jobs:
name: "Version ${{ steps.get_version.outputs.VERSION }}"
tag_name: "v${{ steps.get_version.outputs.VERSION }}"
files: |
build/*
build/*

@ -19,7 +19,7 @@ jobs:
declare -a arr=()
OIFS="$IFS"
IFS=$'\n,'
for line in $(script/build.sh -t); do
for line in $(BUILD_CONFIG=script/build.config.sh bash script/build.sh --show-all-targets); do
arr+=("$line")
done
IFS="$OIFS"
@ -45,7 +45,7 @@ jobs:
- name: Build
run: |
bash script/build.sh -v dev -p "${{ matrix.target }}" -m '-a -v -x'
BUILD_CONFIG=script/build.config.sh bash script/build.sh --version=dev --platforms="${{ matrix.target }}" --more-go-cmd-args='-a -v -x'
- name: Release
uses: softprops/action-gh-release@v2

@ -6,15 +6,17 @@ ARG SKIP_INIT_WEB
ENV SKIP_INIT_WEB=${SKIP_INIT_WEB}
ENV BUILD_CONFIG=script/build.config.sh
WORKDIR /synctv
COPY ./ ./
RUN apk add --no-cache bash curl git go g++
RUN bash script/build.sh -Mv ${VERSION} \
-f 'gcc -static' -F 'g++ -static' \
-m '-a -v'
RUN bash script/build.sh --disable-micro --version=${VERSION} \
--force-gcc='gcc -static' --force-g++='g++ -static' \
--more-go-cmd-args='-a -v'
FROM alpine:latest

@ -0,0 +1,70 @@
function parseDepArgs() {
while [[ $# -gt 0 ]]; do
case "${1}" in
# dep
--version=*)
version="${1#*=}"
shift
;;
--skip-init-web)
skip_init_web="true"
shift
;;
--web-version=*)
web_version="${1#*=}"
shift
;;
*)
break
;;
esac
done
echo "$@"
}
function printDepHelp() {
echo -e "${COLOR_YELLOW}--version=${COLOR_RESET} set build version (default: dev)"
echo -e "${COLOR_YELLOW}--web-version=${COLOR_RESET} set web dependency version (default: VERSION)"
echo -e "${COLOR_YELLOW}--skip-init-web${COLOR_RESET}"
}
function printDepEnvHelp() {
echo -e "${COLOR_GREEN}VERSION${COLOR_RESET} (default: dev)"
echo -e "${COLOR_GREEN}WEB_VERSION${COLOR_RESET} set web dependency version (default: VERSION)"
echo -e "${COLOR_GREEN}SKIP_INIT_WEB${COLOR_RESET}"
}
function initDepPlatforms() {
if ! isCGOEnabled; then
deleteFromAllowedPlatforms "linux/mips,linux/mips64,linux/mips64le,linux/mipsle,linux/ppc64"
deleteFromAllowedPlatforms "windows/386,windows/arm"
fi
}
function initDep() {
setDefault "version" "dev"
version="$(echo "$version" | sed 's/ //g' | sed 's/"//g' | sed 's/\n//g')"
if [[ "${version}" != "dev" ]] && [[ ! "${version}" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+(-beta.*|-rc.*|-alpha.*)?$ ]]; then
echo "version format error: ${version}"
return 1
fi
setDefault "web_version" "${version}"
setDefault "skip_init_web" ""
echo -e "${COLOR_BLUE}version:${COLOR_RESET} ${COLOR_GREEN}${version}${COLOR_RESET}"
addLDFLAGS "-X 'github.com/synctv-org/synctv/internal/version.Version=${version}'"
setDefault "web_version" "${version}"
addLDFLAGS "-X 'github.com/synctv-org/synctv/internal/version.WebVersion=${web_version}'"
local git_commit
git_commit="$(git log --pretty=format:"%h" -1)" || git_commit="unknown"
addLDFLAGS "-X 'github.com/synctv-org/synctv/internal/version.GitCommit=${git_commit}'"
if [[ -z "${skip_init_web}" ]] && [[ -n "${web_version}" ]]; then
downloadAndUnzip "https://github.com/synctv-org/synctv-web/releases/download/${web_version}/dist.tar.gz" "${source_dir}/public/dist"
fi
addTags "jsoniter"
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save