From e84bf324d4f85cb585d3cde29852099ee696064f Mon Sep 17 00:00:00 2001 From: Max Howell Date: Wed, 15 Jan 2025 11:11:29 -0500 Subject: [PATCH] Install pkgm alongside pkgx (#251) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- .github/workflows/ci.installer.yml | 11 +++++++++++ README.md | 9 ++------- installer.sh | 6 +++++- scripts/publish-release.sh | 17 +++++++++-------- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.installer.yml b/.github/workflows/ci.installer.yml index f69a5a9..53b529d 100644 --- a/.github/workflows/ci.installer.yml +++ b/.github/workflows/ci.installer.yml @@ -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 diff --git a/README.md b/README.md index d6e6e4c..ba0509a 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/installer.sh b/installer.sh index 89e19cf..52f074c 100755 --- a/installer.sh +++ b/installer.sh @@ -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 @@ -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 diff --git a/scripts/publish-release.sh b/scripts/publish-release.sh index 7fee99f..7d2727f 100755 --- a/scripts/publish-release.sh +++ b/scripts/publish-release.sh @@ -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 \ @@ -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