Skip to content

Commit

Permalink
Install pkgm alongside pkgx
Browse files Browse the repository at this point in the history
* Not a complete implementation since we need to check if there’s a newer pkgm separate to pkgx.
* Default action to install pkgx^1 by default since we need a major version bump to switch to ^2
  • Loading branch information
mxcl committed Jan 13, 2025
1 parent 2326be7 commit ae4c983
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
# - ubuntu:bionic glibc too old
- ubuntu:focal
- ubuntu:jammy
- ubuntu:lunar
- ubuntu:noble

- fedora:latest

Expand Down
13 changes: 4 additions & 9 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@v1
- uses: pkgxdev/setup@v2
```
Installs the latest version of `pkgx`.

See [`action.yml`] for all inputs and outputs, but here’s the usual ones:

```yaml
- uses: pkgxdev/setup@v1
- uses: pkgxdev/setup@v2
with:
+: [email protected]
[email protected] # we understand colloquial names, generally just type what you know
Expand All @@ -32,11 +32,6 @@ $ pkgx +rust
> See [`@pkgxdev/dev`] to run the `dev` command in a GitHub Actions compatible manner


### Shell Integration

We cannot integrate with the GitHub Actions shell. But you probably don’t
need it.

### Should you Cache `~/.pkgx`?

No. pkgx packages are just tarballs. Caching is just a tarball. You’ll likely
Expand All @@ -52,8 +47,8 @@ To install `pkgx`:
```sh
$ curl https://pkgx.sh | sh
# - installs to `/usr/local/bin/pkgx`
# - if pkgx is already installed it’s a noop
# - installs to `pkgx` & `pkgm` to `/usr/local/bin`
# - if both are already installed, does an update check
```

## Temporary Sandboxes
Expand Down
2 changes: 1 addition & 1 deletion action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function go() {
data: prefix.join(".data"),
cache: prefix.join(".cache"),
pantries: [],
UserAgent: 'pkgx.setup/0.1.0', //TODO version
UserAgent: 'pkgx.setup/0.2.0', //TODO version
options: { compression: 'gz' }
})
const { map, flatten } = useShellEnv()
Expand Down
6 changes: 5 additions & 1 deletion installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ _install_pkgx() {
progress="--progress-bar"
fi

tmpdir=$(mktemp -d)
tmpdir="$(mktemp -d)"

if [ $# -eq 0 ]; then
if [ -f /usr/local/bin/pkgx ]; then
Expand All @@ -69,10 +69,14 @@ _install_pkgx() {
pipe="$tmpdir/pipe"
mkfifo "$pipe"

curl --silent --fail --proto '=https' -o "$tmpdir/pkgm" \
https://pkgxdev.github.io/pkgm/pkgm.ts

curl $progress --fail --proto '=https' "https://pkgx.sh/$(uname)/$(uname -m)".tgz > "$pipe" &
$SUDO sh -c "
mkdir -p /usr/local/bin
tar xz --directory /usr/local/bin < '$pipe'
install -m 755 "$tmpdir/pkgm" /usr/local/bin
" &
wait

Expand Down

0 comments on commit ae4c983

Please sign in to comment.