Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/cd.installer.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: cd·installer

on:
pull_request:
paths:
Expand All @@ -10,6 +12,7 @@ on:

jobs:
cd:
if: github.repository == 'pkgxdev/mash'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -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
66 changes: 66 additions & 0 deletions .github/workflows/cd.www.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: cd·www

on:
push:
branches: main
paths:
- .github/workflows/deploy.yml
- .github/scripts/*
- scripts/*
pull_request:
paths:
- .github/workflows/deploy.yml
schedule:
- cron: '23 * * * *'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
if: github.repository == 'pkgxdev/mash'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pkgxdev/setup@v3

- name: trawl
run: .github/scripts/trawl.ts --out ./build
env:
GH_TOKEN: ${{ github.token }}

- name: index
run: |
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

- uses: actions/configure-pages@v4
- uses: actions/upload-pages-artifact@v3
with:
path: out

deploy:
needs: build
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
steps:
- uses: actions/deploy-pages@v4
id: deployment
70 changes: 28 additions & 42 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,43 @@
name: cd·vx

on:
push:
branches: main
paths:
- .github/workflows/deploy.yml
- .github/scripts/*
- scripts/*
pull_request:
paths:
- .github/workflows/deploy.yml
schedule:
- cron: '23 * * * *'
workflow_dispatch:
release:
types:
- published

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: cd/vx/${{ github.event.release.tag_name }}
cancel-in-progress: true

permissions:
contents: write

jobs:
build:
retag:
if: github.repository == 'pkgxdev/mash'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pkgxdev/setup@v3
- uses: fischerscode/tagger@v0
with:
prefix: v
- run: |
git tag -f latest
git push origin latest --force

- name: trawl
run: .github/scripts/trawl.ts --out ./build
env:
GH_TOKEN: ${{ github.token }}
attach:
if: github.repository == 'pkgxdev/mash'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: index
- name: version
run: sed -i s/mash 0.0.0-dev/mash ${{ github.event.release.tag_name }}/g ./mash

- name: prep
run: |
mkdir out
.github/scripts/index.ts --input ./build > ./out/index.json

- name: build
run: .github/scripts/build.ts --input ./build --output ./out --index-json ./out/index.json

- uses: actions/configure-pages@v4
- uses: actions/upload-pages-artifact@v3
with:
path: out
mv ./mash ./out/mash-${{ github.event.release.tag_name }}.sh

deploy:
needs: build
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
steps:
- uses: actions/deploy-pages@v4
id: deployment
- name: attach
run: gh release upload ${{ github.event.release.tag_name }} ./out/mash-${{ github.event.release.tag_name }}.sh
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
15 changes: 3 additions & 12 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions mash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading