Skip to content

Commit

Permalink
Install pkgm alongside pkgx (#251)
Browse files Browse the repository at this point in the history
* Install pkgm alongside pkgx
* 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 authored Jan 15, 2025
1 parent 8e49a29 commit e84bf32
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci.installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,14 @@ jobs:
- run: test "$(pkgx --version)" = 'pkgx 1.0.0'
- run: ./installer.sh
- run: pkgx semverator gt $(pkgx --version | awk '{print $2}') 1.0.0

pkgm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: '! pkgm --version'
- run: '! deno --version'
- run: cat ./installer.sh | sh
- run: pkgm --version
- run: pkgm i deno
- run: deno --version
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `pkgx` & `pkgm` to `/usr/local/bin`
# - if both are already installed, does an update check
```

## Temporary Sandboxes
Expand Down
6 changes: 5 additions & 1 deletion installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,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 @@ -130,10 +130,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
17 changes: 9 additions & 8 deletions scripts/publish-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ major|minor|patch|prerelease)
esac

if [ $v_new = $v_latest ]; then
echo "$v_new already exists!" >&2
echo v"$v_new already exists!" >&2
exit 1
fi

if ! gh release view v$v_new >/dev/null 2>&1; then
gum confirm "prepare draft release for $v_new?" || exit 1
gum confirm "prepare draft release for v$v_new?" || exit 1

gh release create \
v$v_new \
Expand All @@ -74,23 +74,24 @@ if ! gh run watch --exit-status $run_id; then
exit $foo
fi

git checkout -b v$v_new-branch
npm run dist
git add ./action.js
git commit --message $v_new
git tag $v_new
git push origin $v_new
git tag v$v_new
git push origin v$v_new

gh release upload --clobber v$v_new ./installer.sh ./action.js

# reset so we don’t accidentally commit it
git co action.js

gh release view v$v_new

gum confirm "draft prepared, release $v_new?" || exit 1
gum confirm "draft prepared, release v$v_new?" || exit 1

gh release edit \
v$v_new \
--verify-tag \
--latest \
--draft=false

git checkout main
git branch -D v$v_new-branch

0 comments on commit e84bf32

Please sign in to comment.