From 099ceb6694e2e65399e20178414deeafef6cf7dc Mon Sep 17 00:00:00 2001 From: Max Howell Date: Thu, 23 Jan 2025 17:09:17 -0500 Subject: [PATCH 1/2] rename cd.yml --- .github/workflows/{cd.yml => cd.www.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{cd.yml => cd.www.yml} (100%) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.www.yml similarity index 100% rename from .github/workflows/cd.yml rename to .github/workflows/cd.www.yml From 74bf8bc9c5c484ab7f3fc467f18191a9d567a99c Mon Sep 17 00:00:00 2001 From: Max Howell Date: Thu, 23 Jan 2025 17:22:34 -0500 Subject: [PATCH 2/2] new installer logic etc. --- .github/workflows/cd.installer.yml | 10 +++++++ .github/workflows/cd.www.yml | 9 +++++++ .github/workflows/cd.yml | 43 ++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 3 +++ installer.sh | 15 +++-------- mash | 5 ++++ 6 files changed, 73 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.installer.yml b/.github/workflows/cd.installer.yml index 2b9b433..ae46cb0 100644 --- a/.github/workflows/cd.installer.yml +++ b/.github/workflows/cd.installer.yml @@ -1,3 +1,5 @@ +name: cd·installer + on: pull_request: paths: @@ -10,6 +12,7 @@ on: jobs: cd: + if: github.repository == 'pkgxdev/mash' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -25,3 +28,10 @@ jobs: - run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} --paths / /installer.sh + + test: + needs: cd + runs-on: ubuntu-latest + steps: + - run: curl -L mash.pkgx.sh | sh + - run: mash demo test-pattern diff --git a/.github/workflows/cd.www.yml b/.github/workflows/cd.www.yml index f2d2a15..799cefd 100644 --- a/.github/workflows/cd.www.yml +++ b/.github/workflows/cd.www.yml @@ -1,3 +1,5 @@ +name: cd·www + on: push: branches: main @@ -34,6 +36,13 @@ jobs: mkdir out .github/scripts/index.ts --input ./build > ./out/index.json + - uses: robinraju/release-downloader@v1.11 + with: + latest: true + fileName: mash-*.sh + + - run: mv mash-*.sh ./out/mash.sh + - name: build run: .github/scripts/build.ts --input ./build --output ./out --index-json ./out/index.json diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..cdad3de --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,43 @@ +name: cd·vx + +on: + release: + types: + - published + +concurrency: + group: cd/vx/${{ github.event.release.tag_name }} + cancel-in-progress: true + +permissions: + contents: write + +jobs: + retag: + if: github.repository == 'pkgxdev/mash' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: fischerscode/tagger@v0 + with: + prefix: v + - run: | + git tag -f latest + git push origin latest --force + + attach: + if: github.repository == 'pkgxdev/mash' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: version + run: sed -i s/mash 0.0.0-dev/mash ${{ github.event.release.tag_name }}/g ./mash + + - name: prep + run: | + mkdir out + mv ./mash ./out/mash-${{ github.event.release.tag_name }}.sh + + - name: attach + run: gh release upload ${{ github.event.release.tag_name }} ./out/mash-${{ github.event.release.tag_name }}.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f495592..4249f6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,12 @@ +name: ci + on: pull_request: paths: mash jobs: test: + if: github.repository == 'pkgxdev/mash' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/installer.sh b/installer.sh index d22faaa..0ba5965 100755 --- a/installer.sh +++ b/installer.sh @@ -26,17 +26,8 @@ fi if [ $# -gt 0 ]; then exec pkgx +pkgx.sh/mash -- mash "$@" else - pkgx install mash - - if [ -f /usr/bin/which ]; then - pkgxd="$(dirname "$(which pkgx)")" - - if [ ! -w "$pkgxd" ]; then - SUDO=sudo - fi - - $SUDO mv $HOME/.local/bin/mash "$pkgxd" - fi - + tmp="$(mktemp)" + curl -Ssf https://pkgxdev.github.io/mash/mash.sh > $tmp + sudo install -m 0755 "$tmp" /usr/local/bin/mash echo "now type: mash" 1>&2 fi diff --git a/mash b/mash index 286c8ee..c485384 100755 --- a/mash +++ b/mash @@ -2,6 +2,11 @@ set -eo pipefail +if [ "$1" == --version ]; then + echo "mash 0.0.0-dev" + exit 0 +fi + if [ -n "$RUNNER_DEBUG" -a -n "$GITHUB_ACTIONS" ] || [ -n "$VERBOSE" ]; then set -x fi