Skip to content

Commit b491cea

Browse files
authored
Merge pull request #16 from pkgxdev/pkgx@2
pkgx@2
2 parents 8a75c27 + 74bf8bc commit b491cea

File tree

6 files changed

+115
-54
lines changed

6 files changed

+115
-54
lines changed

.github/workflows/cd.installer.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: cd·installer
2+
13
on:
24
pull_request:
35
paths:
@@ -10,6 +12,7 @@ on:
1012

1113
jobs:
1214
cd:
15+
if: github.repository == 'pkgxdev/mash'
1316
runs-on: ubuntu-latest
1417
steps:
1518
- uses: actions/checkout@v4
@@ -25,3 +28,10 @@ jobs:
2528
- run: aws cloudfront create-invalidation
2629
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
2730
--paths / /installer.sh
31+
32+
test:
33+
needs: cd
34+
runs-on: ubuntu-latest
35+
steps:
36+
- run: curl -L mash.pkgx.sh | sh
37+
- run: mash demo test-pattern

.github/workflows/cd.www.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: cd·www
2+
3+
on:
4+
push:
5+
branches: main
6+
paths:
7+
- .github/workflows/deploy.yml
8+
- .github/scripts/*
9+
- scripts/*
10+
pull_request:
11+
paths:
12+
- .github/workflows/deploy.yml
13+
schedule:
14+
- cron: '23 * * * *'
15+
workflow_dispatch:
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
build:
23+
if: github.repository == 'pkgxdev/mash'
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: pkgxdev/setup@v3
28+
29+
- name: trawl
30+
run: .github/scripts/trawl.ts --out ./build
31+
env:
32+
GH_TOKEN: ${{ github.token }}
33+
34+
- name: index
35+
run: |
36+
mkdir out
37+
.github/scripts/index.ts --input ./build > ./out/index.json
38+
39+
- uses: robinraju/[email protected]
40+
with:
41+
latest: true
42+
fileName: mash-*.sh
43+
44+
- run: mv mash-*.sh ./out/mash.sh
45+
46+
- name: build
47+
run: .github/scripts/build.ts --input ./build --output ./out --index-json ./out/index.json
48+
49+
- uses: actions/configure-pages@v4
50+
- uses: actions/upload-pages-artifact@v3
51+
with:
52+
path: out
53+
54+
deploy:
55+
needs: build
56+
runs-on: ubuntu-latest
57+
if: ${{ github.event_name != 'pull_request' }}
58+
environment:
59+
name: github-pages
60+
url: ${{ steps.deployment.outputs.page_url }}
61+
permissions:
62+
pages: write # to deploy to Pages
63+
id-token: write # to verify the deployment originates from an appropriate source
64+
steps:
65+
- uses: actions/deploy-pages@v4
66+
id: deployment

.github/workflows/cd.yml

Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,43 @@
1+
name: cd·vx
2+
13
on:
2-
push:
3-
branches: main
4-
paths:
5-
- .github/workflows/deploy.yml
6-
- .github/scripts/*
7-
- scripts/*
8-
pull_request:
9-
paths:
10-
- .github/workflows/deploy.yml
11-
schedule:
12-
- cron: '23 * * * *'
13-
workflow_dispatch:
4+
release:
5+
types:
6+
- published
147

158
concurrency:
16-
group: ${{ github.workflow }}-${{ github.ref }}
9+
group: cd/vx/${{ github.event.release.tag_name }}
1710
cancel-in-progress: true
1811

12+
permissions:
13+
contents: write
14+
1915
jobs:
20-
build:
16+
retag:
2117
if: github.repository == 'pkgxdev/mash'
2218
runs-on: ubuntu-latest
2319
steps:
2420
- uses: actions/checkout@v4
25-
- uses: pkgxdev/setup@v3
21+
- uses: fischerscode/tagger@v0
22+
with:
23+
prefix: v
24+
- run: |
25+
git tag -f latest
26+
git push origin latest --force
2627
27-
- name: trawl
28-
run: .github/scripts/trawl.ts --out ./build
29-
env:
30-
GH_TOKEN: ${{ github.token }}
28+
attach:
29+
if: github.repository == 'pkgxdev/mash'
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
3133

32-
- name: index
34+
- name: version
35+
run: sed -i s/mash 0.0.0-dev/mash ${{ github.event.release.tag_name }}/g ./mash
36+
37+
- name: prep
3338
run: |
3439
mkdir out
35-
.github/scripts/index.ts --input ./build > ./out/index.json
36-
37-
- name: build
38-
run: .github/scripts/build.ts --input ./build --output ./out --index-json ./out/index.json
39-
40-
- uses: actions/configure-pages@v4
41-
- uses: actions/upload-pages-artifact@v3
42-
with:
43-
path: out
40+
mv ./mash ./out/mash-${{ github.event.release.tag_name }}.sh
4441
45-
deploy:
46-
needs: build
47-
runs-on: ubuntu-latest
48-
if: ${{ github.event_name != 'pull_request' }}
49-
environment:
50-
name: github-pages
51-
url: ${{ steps.deployment.outputs.page_url }}
52-
permissions:
53-
pages: write # to deploy to Pages
54-
id-token: write # to verify the deployment originates from an appropriate source
55-
steps:
56-
- uses: actions/deploy-pages@v4
57-
id: deployment
42+
- name: attach
43+
run: gh release upload ${{ github.event.release.tag_name }} ./out/mash-${{ github.event.release.tag_name }}.sh

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
name: ci
2+
13
on:
24
pull_request:
35
paths: mash
46

57
jobs:
68
test:
9+
if: github.repository == 'pkgxdev/mash'
710
runs-on: ubuntu-latest
811
steps:
912
- uses: actions/checkout@v4

installer.sh

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,8 @@ fi
2626
if [ $# -gt 0 ]; then
2727
exec pkgx +pkgx.sh/mash -- mash "$@"
2828
else
29-
pkgx install mash
30-
31-
if [ -f /usr/bin/which ]; then
32-
pkgxd="$(dirname "$(which pkgx)")"
33-
34-
if [ ! -w "$pkgxd" ]; then
35-
SUDO=sudo
36-
fi
37-
38-
$SUDO mv $HOME/.local/bin/mash "$pkgxd"
39-
fi
40-
29+
tmp="$(mktemp)"
30+
curl -Ssf https://pkgxdev.github.io/mash/mash.sh > $tmp
31+
sudo install -m 0755 "$tmp" /usr/local/bin/mash
4132
echo "now type: mash" 1>&2
4233
fi

mash

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
set -eo pipefail
44

5+
if [ "$1" == --version ]; then
6+
echo "mash 0.0.0-dev"
7+
exit 0
8+
fi
9+
510
if [ -n "$RUNNER_DEBUG" -a -n "$GITHUB_ACTIONS" ] || [ -n "$VERBOSE" ]; then
611
set -x
712
fi

0 commit comments

Comments
 (0)