fix: build permission (#234)

* fix: no permission

* fix: build branch

* fix: build permission

* fix: osx glib version
This commit is contained in:
zijiren 2024-09-18 17:23:06 +08:00 committed by GitHub
parent a479bd8efd
commit 178cf5a202
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 11 deletions

View File

@ -2,9 +2,7 @@ name: build
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@ -52,4 +50,8 @@ jobs:
- name: Build
run: |
BUILD_CONFIG=script/build.config.sh bash script/build.sh --skip-init-web --platforms="${{ matrix.target }}" --more-go-cmd-args='-a -v -x'
sudo BUILD_CONFIG=script/build.config.sh bash \
script/build.sh \
--skip-init-web \
--platforms="${{ matrix.target }}" \
--more-go-cmd-args='-a -v -x'

View File

@ -206,8 +206,8 @@ function downloadAndUnzip() {
local file="$2"
local type="${3:-$(echo "${url}" | sed 's/.*\.//g')}"
mkdir -p "${file}"
file="$(cd "${file}" && pwd)"
mkdir -p "${file}" || return $?
file="$(cd "${file}" && pwd)" || return $?
echo -e "${COLOR_LIGHT_BLUE}Downloading ${COLOR_LIGHT_CYAN}\"${url}\"${COLOR_LIGHT_BLUE} to ${COLOR_LIGHT_CYAN}\"${file}\"${COLOR_RESET}"
rm -rf "${file}"/*
@ -614,8 +614,9 @@ function initOsxCGO() {
cxx="/usr/local/osxcross/bin/oa64-clang++"
EXTRA_PATH="/usr/local/osxcross/bin"
else
downloadAndUnzip "${GH_PROXY}https://github.com/zijiren233/osxcross/releases/download/v0.1.1/osxcross-14-5-linux-amd64-gnu-ubuntu-18.04.tar.gz" \
"/usr/local/osxcross"
local ubuntu_version=$(lsb_release -rs 2>/dev/null || echo "18.04")
downloadAndUnzip "${GH_PROXY}https://github.com/zijiren233/osxcross/releases/download/v0.1.1/osxcross-14-5-linux-amd64-gnu-ubuntu-${ubuntu_version}.tar.gz" \
"/usr/local/osxcross" || return 2
cc="/usr/local/osxcross/bin/oa64-clang"
cxx="/usr/local/osxcross/bin/oa64-clang++"
EXTRA_PATH="/usr/local/osxcross/bin"
@ -666,7 +667,7 @@ function initLinuxCGO() {
cxx="${cgo_cross_compiler_dir}/${cross_compiler_name}/bin/${arch_prefix}-linux-musl${abi}${micro}-g++"
else
downloadAndUnzip "${GH_PROXY}https://github.com/zijiren233/musl-cross-make/releases/download/${CGO_DEPS_VERSION}/${cross_compiler_name}-${unamespacer}.tgz" \
"${cgo_cross_compiler_dir}/${cross_compiler_name}"
"${cgo_cross_compiler_dir}/${cross_compiler_name}" || return 2
cc="${cgo_cross_compiler_dir}/${cross_compiler_name}/bin/${arch_prefix}-linux-musl${abi}${micro}-gcc"
cxx="${cgo_cross_compiler_dir}/${cross_compiler_name}/bin/${arch_prefix}-linux-musl${abi}${micro}-g++"
fi
@ -701,7 +702,7 @@ function initWindowsCGO() {
cxx="${cgo_cross_compiler_dir}/${cross_compiler_name}/bin/${arch_prefix}-w64-mingw32-g++"
else
downloadAndUnzip "${GH_PROXY}https://github.com/zijiren233/musl-cross-make/releases/download/${CGO_DEPS_VERSION}/${cross_compiler_name}-${unamespacer}.tgz" \
"${cgo_cross_compiler_dir}/${cross_compiler_name}"
"${cgo_cross_compiler_dir}/${cross_compiler_name}" || return 2
cc="${cgo_cross_compiler_dir}/${cross_compiler_name}/bin/${arch_prefix}-w64-mingw32-gcc"
cxx="${cgo_cross_compiler_dir}/${cross_compiler_name}/bin/${arch_prefix}-w64-mingw32-g++"
fi
@ -728,9 +729,9 @@ function initAndroidNDK() {
if [[ ! -d "${ndk_dir}" ]]; then
local ndk_url="https://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-${GOHOSTOS}.zip"
downloadAndUnzip "${ndk_url}" "${ndk_dir}" "zip"
downloadAndUnzip "${ndk_url}" "${ndk_dir}" "zip" || return 2
mv "$ndk_dir/android-ndk-${NDK_VERSION}/"* "$ndk_dir"
rmdir "$ndk_dir/android-ndk-${NDK_VERSION}"
rmdir "$ndk_dir/android-ndk-${NDK_VERSION}" || return 2
fi
if [[ ! -x "${cc}" ]] || [[ ! -x "${cxx}" ]]; then