From 6b6c1c2898b0402c06319b424ccf6a3b4295bcba Mon Sep 17 00:00:00 2001 From: Max Howell Date: Tue, 14 Jan 2025 16:30:21 -0500 Subject: [PATCH] output & ci fixes --- .github/workflows/ci.installer.yml | 44 +++++++++++++++++++++++------- README.md | 4 +-- installer.sh | 30 ++++++++++++-------- 3 files changed, 55 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.installer.yml b/.github/workflows/ci.installer.yml index 5bc34173..1a941fe3 100644 --- a/.github/workflows/ci.installer.yml +++ b/.github/workflows/ci.installer.yml @@ -30,9 +30,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: cat ./installer.sh | sh -s node --eval 'console.log(1)' - - run: ./installer.sh sh -c "which pkgx" - - run: source <(cat ./installer.sh) duf + - run: cat ./installer.sh | sh -s deno eval 'console.log(1)' + - run: ./installer.sh -- sh -c "which pkgx" + - run: sh <(cat ./installer.sh) duf - run: if command -v pkgx; then exit 1; fi sudo-not-required: @@ -53,8 +53,16 @@ jobs: steps: - uses: actions/checkout@v4 - run: | - eval "$(cat ./installer.sh)" - env +duf + vMAJOR=$(curl https://pkgx.sh/VERSION | cut -d. -f1) + + if [ "$vMAJOR" -lt 2 ]; then + eval "$(cat ./installer.sh)" + env +duf + else + eval "$(cat ./installer.sh)" + eval "$(pkgx +duf)" + fi + duf --version test -n "$BASH_VERSION" @@ -73,8 +81,16 @@ jobs: - uses: actions/checkout@v4 - run: | - eval "$(cat ./installer.sh)" - env +duf + vMAJOR=$(curl https://pkgx.sh/VERSION | cut -d. -f1) + + if [ "$vMAJOR" -lt 2 ]; then + eval "$(cat ./installer.sh)" + env +duf + else + eval "$(cat ./installer.sh)" + eval "$(pkgx +duf)" + fi + duf --version test -n "$ZSH_VERSION" @@ -86,8 +102,16 @@ jobs: steps: - uses: actions/checkout@v4 - run: | - eval "$(cat ./installer.sh)" - env +duf + vMAJOR=$(curl https://pkgx.sh/VERSION | cut -d. -f1) + + if [ "$vMAJOR" -lt 2 ]; then + eval "$(cat ./installer.sh)" + env +duf + else + eval "$(cat ./installer.sh)" + eval "$(pkgx +duf)" + fi + duf --version test -z "$ZSH_VERSION" @@ -161,7 +185,7 @@ jobs: env: PATH: ${{ github.workspace }}/bin:/usr/bin:/bin - - run: pkgx node --eval 'console.log(1)' + - run: pkgx deno eval 'console.log(1)' upgrades: runs-on: ubuntu-latest diff --git a/README.md b/README.md index de47d4a5..d6e6e4c6 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ # GitHub Action ```yaml -- uses: pkgxdev/setup@v2 +- uses: pkgxdev/setup@v3 ``` Installs the latest version of `pkgx`. @@ -15,7 +15,7 @@ Installs the latest version of `pkgx`. See [`action.yml`] for all inputs and outputs, but here’s the usual ones: ```yaml -- uses: pkgxdev/setup@v2 +- uses: pkgxdev/setup@v3 with: +: deno@1.30 rust@1.60 # we understand colloquial names, generally just type what you know diff --git a/installer.sh b/installer.sh index 6ff353de..2e246f8d 100755 --- a/installer.sh +++ b/installer.sh @@ -54,20 +54,23 @@ _install_pre_reqs() { # minimal but required or networking doesn’t work # https://packages.debian.org/buster/all/netbase/filelist - A=netbase + A="netbase" # difficult to pkg in our opinion B=libudev-dev + # ca-certs needed until we bundle our own root cert + C=ca-certificates + case $(cat /etc/debian_version) in jessie/sid|8.*|stretch/sid|9.*) - apt --yes install libc-dev libstdc++-4.8-dev libgcc-4.7-dev $A $B;; + apt install --yes libc-dev libstdc++-4.8-dev libgcc-4.7-dev $A $B $C;; buster/sid|10.*) - apt --yes install libc-dev libstdc++-8-dev libgcc-8-dev $A $B;; + apt install --yes libc-dev libstdc++-8-dev libgcc-8-dev $A $B $C;; bullseye/sid|11.*) - apt --yes install libc-dev libstdc++-10-dev libgcc-9-dev $A $B;; + apt install --yes libc-dev libstdc++-10-dev libgcc-9-dev $A $B $C;; bookworm/sid|12.*|*) - apt --yes install libc-dev libstdc++-11-dev libgcc-11-dev $A $B;; + apt install --yes libc-dev libstdc++-11-dev libgcc-11-dev $A $B $C;; esac elif test -f /etc/fedora-release; then $SUDO yum --assumeyes install libatomic @@ -129,10 +132,12 @@ _install_pkgx() { } _pkgx_is_old() { - v="$(/usr/local/bin/pkgx --version || echo pkgx 0)" - /usr/local/bin/pkgx --silent semverator gt \ - $(curl -Ssf https://pkgx.sh/VERSION) \ - $(echo $v | awk '{print $2}') + new_version=$(curl -Ssf https://pkgx.sh/VERSION) + old_version=$(/usr/local/bin/pkgx --version || echo pkgx 0) + old_version=$(echo $old_version | cut -d' ' -f2) + major_version=$(echo $new_version | cut -d. -f1) + + /usr/local/bin/pkgx --silent semverator gt $new_version $old_version } _should_install_pkgx() { @@ -160,8 +165,11 @@ if [ $# -gt 0 ]; then elif [ $(basename "/$0") != 'installer.sh' ]; then # ^^ temporary exception for action.ts - if type eval >/dev/null 2>&1; then - # we `type eval` as on Travis there was no `eval`! + if ! [ "$major_version" = "0" ]; then + major_version=$(pkgx --version | cut -d' ' -f2 | cut -d. -f1) + fi + + if [ $major_version -lt 2 ] && type eval >/dev/null 2>&1; then eval "$(pkgx --shellcode)" 2>/dev/null fi