Skip to content

Commit

Permalink
output & ci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Jan 15, 2025
1 parent d703046 commit 6b6c1c2
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 23 deletions.
44 changes: 34 additions & 10 deletions .github/workflows/ci.installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
# GitHub Action

```yaml
- uses: pkgxdev/setup@v2
- uses: pkgxdev/setup@v3
```
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:
+: [email protected]
[email protected] # we understand colloquial names, generally just type what you know
Expand Down
30 changes: 19 additions & 11 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 6b6c1c2

Please sign in to comment.