Skip to content

Commit 481b004

Browse files
publish cli from eb44eb7d7f42ea27012d5e6313bd8fd059d92975
1 parent 67c5b76 commit 481b004

19 files changed

Lines changed: 1710 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
validate:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out repository
14+
uses: actions/checkout@v4
15+
16+
- name: Install Bun
17+
run: |
18+
curl -fsSL https://bun.sh/install | bash
19+
echo "$HOME/.bun/bin" >> "$GITHUB_PATH"
20+
21+
- name: Install dependencies
22+
run: bun install --frozen-lockfile
23+
24+
- name: Typecheck
25+
run: bun run typecheck
26+
27+
- name: Test
28+
run: bun test
29+
30+
- name: Build
31+
run: bun run build

.github/workflows/edge.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Edge
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- CI
7+
types:
8+
- completed
9+
branches:
10+
- main
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
prepare:
17+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
18+
runs-on: ubuntu-latest
19+
outputs:
20+
publish: ${{ steps.guard.outputs.publish }}
21+
steps:
22+
- name: Check out successful commit
23+
uses: actions/checkout@v4
24+
with:
25+
ref: ${{ github.event.workflow_run.head_sha }}
26+
fetch-depth: 0
27+
28+
- name: Skip stale workflow runs
29+
id: guard
30+
run: |
31+
git fetch origin main --depth=1
32+
current_sha="$(git rev-parse origin/main)"
33+
34+
if [ "$current_sha" != "${{ github.event.workflow_run.head_sha }}" ]; then
35+
echo "publish=false" >> "$GITHUB_OUTPUT"
36+
echo "::notice::Skipping stale edge build for ${{ github.event.workflow_run.head_sha }}; main is ${current_sha}."
37+
exit 0
38+
fi
39+
40+
echo "publish=true" >> "$GITHUB_OUTPUT"
41+
42+
- name: Configure git identity
43+
if: steps.guard.outputs.publish == 'true'
44+
run: |
45+
git config user.name "github-actions[bot]"
46+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
47+
48+
- name: Move edge tag
49+
if: steps.guard.outputs.publish == 'true'
50+
run: |
51+
git tag -f edge "${{ github.event.workflow_run.head_sha }}"
52+
git push origin refs/tags/edge --force
53+
54+
- name: Create or update edge release
55+
if: steps.guard.outputs.publish == 'true'
56+
env:
57+
GH_TOKEN: ${{ github.token }}
58+
run: |
59+
NOTES=$(cat <<EOF
60+
Rolling build from main.
61+
62+
- commit: `${{ github.event.workflow_run.head_sha }}`
63+
- workflow run: ${{ github.event.workflow_run.html_url }}
64+
65+
Install or download the latest edge binaries from the assets below.
66+
EOF
67+
)
68+
69+
if gh release view edge >/dev/null 2>&1; then
70+
gh release edit edge --prerelease --title "edge" --notes "$NOTES"
71+
else
72+
gh release create edge --prerelease --title "edge" --notes "$NOTES"
73+
fi
74+
75+
build-binaries:
76+
if: ${{ github.event.workflow_run.conclusion == 'success' && needs.prepare.outputs.publish == 'true' }}
77+
needs: prepare
78+
name: Build ${{ matrix.name }}
79+
runs-on: ${{ matrix.os }}
80+
strategy:
81+
fail-fast: false
82+
matrix:
83+
include:
84+
- os: ubuntu-latest
85+
name: linux-x64
86+
archive: yaffle-linux-x64.tar.gz
87+
checksum: yaffle-linux-x64.sha256
88+
- os: macos-13
89+
name: darwin-x64
90+
archive: yaffle-darwin-x64.tar.gz
91+
checksum: yaffle-darwin-x64.sha256
92+
- os: macos-14
93+
name: darwin-arm64
94+
archive: yaffle-darwin-arm64.tar.gz
95+
checksum: yaffle-darwin-arm64.sha256
96+
97+
steps:
98+
- name: Check out successful commit
99+
uses: actions/checkout@v4
100+
with:
101+
ref: ${{ github.event.workflow_run.head_sha }}
102+
103+
- name: Install Bun
104+
run: |
105+
curl -fsSL https://bun.sh/install | bash
106+
echo "$HOME/.bun/bin" >> "$GITHUB_PATH"
107+
108+
- name: Install dependencies
109+
run: bun install --frozen-lockfile
110+
111+
- name: Build standalone binary
112+
run: |
113+
mkdir -p dist
114+
bun build src/main.ts --compile --outfile dist/yaffle
115+
116+
- name: Package archive
117+
run: |
118+
tar -C dist -czf "${{ matrix.archive }}" yaffle
119+
shasum -a 256 "${{ matrix.archive }}" > "${{ matrix.checksum }}"
120+
121+
- name: Upload edge assets
122+
env:
123+
GH_TOKEN: ${{ github.token }}
124+
run: |
125+
gh release upload edge \
126+
"${{ matrix.archive }}" \
127+
"${{ matrix.checksum }}" \
128+
--clobber

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-binaries:
13+
name: Build ${{ matrix.name }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- os: ubuntu-latest
20+
name: linux-x64
21+
archive: yaffle-linux-x64.tar.gz
22+
checksum: yaffle-linux-x64.sha256
23+
- os: macos-13
24+
name: darwin-x64
25+
archive: yaffle-darwin-x64.tar.gz
26+
checksum: yaffle-darwin-x64.sha256
27+
- os: macos-14
28+
name: darwin-arm64
29+
archive: yaffle-darwin-arm64.tar.gz
30+
checksum: yaffle-darwin-arm64.sha256
31+
32+
steps:
33+
- name: Check out release tag
34+
uses: actions/checkout@v4
35+
with:
36+
ref: ${{ github.event.release.tag_name }}
37+
38+
- name: Install Bun
39+
run: |
40+
curl -fsSL https://bun.sh/install | bash
41+
echo "$HOME/.bun/bin" >> "$GITHUB_PATH"
42+
43+
- name: Install dependencies
44+
run: bun install --frozen-lockfile
45+
46+
- name: Build standalone binary
47+
run: |
48+
mkdir -p dist
49+
bun build src/main.ts --compile --outfile dist/yaffle
50+
51+
- name: Package archive
52+
run: |
53+
tar -C dist -czf "${{ matrix.archive }}" yaffle
54+
shasum -a 256 "${{ matrix.archive }}" > "${{ matrix.checksum }}"
55+
56+
- name: Upload release assets
57+
env:
58+
GH_TOKEN: ${{ github.token }}
59+
run: |
60+
gh release upload "${{ github.event.release.tag_name }}" \
61+
"${{ matrix.archive }}" \
62+
"${{ matrix.checksum }}" \
63+
--clobber

0 commit comments

Comments
 (0)