diff --git a/.github/workflows/build-be.yml b/.github/workflows/build-be.yml index 42cbcca..a449d0a 100644 --- a/.github/workflows/build-be.yml +++ b/.github/workflows/build-be.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Configure paths run: | New-Item -ItemType Directory -Force -Path ./artifacts/release/x64 @@ -36,13 +36,13 @@ jobs: Copy-Item -Path ./assets/windows/doorstop_config.ini -Destination ./artifacts/verbose/x86/doorstop_config.ini Copy-Item -Path ./LICENSE -Destination ./artifacts/verbose/LICENSE - name: Upload Release - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: doorstop_win_release path: artifacts/release include-hidden-files: true - name: Upload Verbose - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: doorstop_win_verbose path: artifacts/verbose @@ -57,7 +57,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Configure paths run: | bash -c "mkdir -p artifacts/{verbose,release,debug}/{x86,x64}" @@ -94,7 +94,7 @@ jobs: cp assets/nix/run.sh artifacts/debug/x64/run.sh cp LICENSE artifacts/debug/LICENSE - name: Upload Release - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: doorstop_linux_release path: artifacts/release @@ -106,7 +106,7 @@ jobs: path: artifacts/verbose include-hidden-files: true - name: Upload Debug - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: doorstop_linux_debug path: artifacts/debug @@ -117,7 +117,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Configure paths run: | mkdir -p artifacts/{verbose,release,debug}/universal @@ -143,7 +143,7 @@ jobs: cp assets/nix/run.sh artifacts/debug/universal/run.sh cp LICENSE artifacts/debug/LICENSE - name: Upload Release - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: doorstop_macos_release path: artifacts/release @@ -155,7 +155,7 @@ jobs: path: artifacts/verbose include-hidden-files: true - name: Upload Debug - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: doorstop_macos_debug path: artifacts/debug @@ -171,7 +171,7 @@ jobs: steps: - name: Download artifacts - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: path: artifacts - name: Grab version @@ -188,6 +188,7 @@ jobs: (cd ${dir}; zip -r ../../dist/${dir}_${{ env.doorstop_version }}.zip *) done - name: Create release + # TODO: find a replacement for this action uses: marvinpinto/action-automatic-releases@latest with: repo_token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/build.ps1 b/build.ps1 index fdfd57c..07a0356 100644 --- a/build.ps1 +++ b/build.ps1 @@ -9,7 +9,7 @@ param ( $ScriptArgs ) -$VERSION = "2.6.1" +$VERSION = "3.1.1" function writeErrorTip($msg) { Write-Host $msg -BackgroundColor Red -ForegroundColor White @@ -57,4 +57,4 @@ foreach ($a in $Arch) { $verbose_opt = if ($with_logging) { "--include_logging=y" } else { "--include_logging=n" } Invoke-Expression "& $XMAKE_EXE f -a $a $verbose_opt" Invoke-Expression "& $XMAKE_EXE $($ScriptArgs -join " ")" -} \ No newline at end of file +} diff --git a/build.sh b/build.sh index 6ca4a49..ea9ad1a 100755 --- a/build.sh +++ b/build.sh @@ -10,6 +10,8 @@ # Bomb out if anything goes wrong set -e +# shellcheck disable=SC2034 +if true; then CBLACK="\033[0;30m" CRED="\033[0;31m" CGREEN="\033[0;32m" @@ -29,29 +31,30 @@ PPINK="\001\033[0;35m\002" PCYAN="\001\033[0;36m\002" PWHITE="\001\033[0;37m\002" PDEFAULT="\001\033[0m\002" +fi function echo-err { echo "$@" 1>&2; } -function ask { echo -ne "${CYELLOW} $1: ${CDEFAULT}"; read ASK; export ASK; } -function ask-default { echo -ne "${CYELLOW} $1 [$2]: ${CDEFAULT}"; read ASK; export ASK=${ASK:-$2}; } -function ask-yes { echo -ne "${CYELLOW} $1 [Y/n]: ${CDEFAULT}"; read ASK; ASK="$(echo $ASK | tr '[:upper:]' '[:lower:]' | head -c 1)"; export ASK=${ASK:-y}; } -function ask-no { echo -ne "${CYELLOW} $1 [y/N]: ${CDEFAULT}"; read ASK; ASK="$(echo $ASK | tr '[:upper:]' '[:lower:]' | head -c 1)"; export ASK=${ASK:-n}; } -function ask-enter { echo -e "${CYELLOW} $1: [Press enter to continue]${CDEFAULT}" ; read; } -function ask-password { echo -ne "${CYELLOW} $1: ${CDEFAULT}" ; read -s ASK; echo; } +function ask { echo -ne "${CYELLOW} $1: ${CDEFAULT}"; read -r ASK; export ASK; } +function ask-default { echo -ne "${CYELLOW} $1 [$2]: ${CDEFAULT}"; read -r ASK; export ASK=${ASK:-$2}; } +function ask-yes { echo -ne "${CYELLOW} $1 [Y/n]: ${CDEFAULT}"; read -r ASK; ASK="$(echo "$ASK" | tr '[:upper:]' '[:lower:]' | head -c 1)"; export ASK=${ASK:-y}; } +function ask-no { echo -ne "${CYELLOW} $1 [y/N]: ${CDEFAULT}"; read -r ASK; ASK="$(echo "$ASK" | tr '[:upper:]' '[:lower:]' | head -c 1)"; export ASK=${ASK:-n}; } +function ask-enter { echo -e "${CYELLOW} $1: [Press enter to continue]${CDEFAULT}" ; read -r; } +function ask-password { echo -ne "${CYELLOW} $1: ${CDEFAULT}" ; read -rs ASK; echo; } -function msg-error { echo -e "${CRED}${@}${CDEFAULT}"; } -function msg-info { echo -e "${CCYAN}${@}${CDEFAULT}"; } -function msg-success { echo -e "${CGREEN}${@}${CDEFAULT}"; } -function msg-dry { echo -e "${CPINK}${@}${CDEFAULT}"; } +function msg-error { echo -e "${CRED}${*}${CDEFAULT}"; } +function msg-info { echo -e "${CCYAN}${*}${CDEFAULT}"; } +function msg-success { echo -e "${CGREEN}${*}${CDEFAULT}"; } +function msg-dry { echo -e "${CPINK}${*}${CDEFAULT}"; } -function date-today { echo $(date +%F); } -function date-second { echo $(date +%F_%H-%M-%S); } +function date-today { date +%F; } +function date-second { date +%F_%H-%M-%S; } function date-8601 { date -u +%Y-%m-%dT%H:%M:%S%z; } function date-8601-local { date +%Y-%m-%dT%H:%M:%S%z; } -function log-8601 { msg-info "[ $(date-8601) ] $@"; } -function log-8601-local { msg-info "[ $(date-8601-local) ] $@"; } -function log-err-8601 { echo-err "[ $(date-8601) ] $@"; } -function log-err-8601-local { echo-err "[ $(date-8601-local) ] $@"; } +function log-8601 { msg-info "[ $(date-8601) ] $*"; } +function log-8601-local { msg-info "[ $(date-8601-local) ] $*"; } +function log-err-8601 { echo-err "[ $(date-8601) ] $*"; } +function log-err-8601-local { echo-err "[ $(date-8601-local) ] $*"; } commands_exist () { while [[ "$1" != "" ]]; do @@ -65,14 +68,15 @@ commands_exist () { help () { echo " - ./build.sh [-with_logging] [-arch=] [--help|-h] [...] + ./build.sh [-with_logging] [-debug] [-arch=] [--help|-h] [...] Script that downloads xmake if it's missing and builds the project Parameters -with_logging : enable logging + -debug : enable debug -arch= : comma-separated list of architectures to build for -h, --help: show this help message ... : additional parameters passed to xmake - " + " 1>&2 } # Parse parameters into variables @@ -83,7 +87,7 @@ ARCHS=("x86" "x64") if [[ "$(uname)" == "Darwin" ]]; then ARCHS=("x86_64") fi -while [[ $# > 0 ]]; do +while [[ $# -gt 0 ]]; do key="$1" case $key in -with_logging) @@ -99,13 +103,17 @@ while [[ $# > 0 ]]; do IFS=',' read -r -a ARCHS <<< "${key#*=}" shift ;; + -h|--help) + help + exit 0 + ;; *) break ;; esac done -XMAKE_VERSION="2.8.9" +XMAKE_VERSION="3.1.1" # Get current dir CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -124,10 +132,10 @@ fi # get make if commands_exist gmake; then if gmake --version >/dev/null 2>&1; then - make=gmake + make="gmake" fi elif commands_exist make; then - make=make + make="make" else msg-error "No make command found, install gmake or make to continue" exit 1 @@ -257,7 +265,7 @@ else for arch in "${ARCHS[@]}" do log-8601-local "Building for $arch..." - "$xmake" f -a $arch -m $PROFILE --include_logging=$WITH_LOGGING + "$xmake" f -a "$arch" -m $PROFILE --include_logging=$WITH_LOGGING "$xmake" "$@" done fi