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
2 changes: 1 addition & 1 deletion .devcontainer/install-prerequisites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ sudo apt-get install -y\
npm install -g @playwright/cli@latest

# install playwright chromium
(cd && playwright-cli install chromium)
(cd && playwright-cli install)
55 changes: 55 additions & 0 deletions .github/workflows/binary-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build and Release Binaries

on:
release:
types:
- published

jobs:
build-binaries:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: linux-x64
- os: ubuntu-latest
target: linux-arm64
- os: macos-latest
target: darwin-x64
- os: macos-latest
target: darwin-arm64

runs-on: ${{ matrix.os }}
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Build web assets
run: bun run build

- name: Build standalone binary
run: bun build --compile --minify --target=bun-${{ matrix.target }} ./src/index.ts --outfile dist/link-${{ github.ref_name }}-${{ matrix.target }}

- name: Upload workflow artifact
uses: actions/upload-artifact@v4
with:
name: link-${{ github.ref_name }}-${{ matrix.target }}
path: dist/link-${{ github.ref_name }}-${{ matrix.target }}
if-no-files-found: error

- name: Upload binary to release
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload ${{ github.ref_name }} dist/link-${{ github.ref_name }}-${{ matrix.target }} --clobber
73 changes: 73 additions & 0 deletions .github/workflows/docker-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build and Push Docker Image (Main Branch)

on:
push:
branches:
- main
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
BUILD_PLATFORMS: linux/amd64

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=main
type=sha,format=short

- name: Build and push Docker image
id: build
uses: docker/build-push-action@v6
with:
context: .
push: true
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: ${{ env.BUILD_PLATFORMS }}

- name: Test container health endpoint
shell: bash
run: |
set -euo pipefail
IMAGE_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n 1)
docker run -d --name link-test -p 3000:3000 "$IMAGE_TAG"
trap 'docker rm -f link-test >/dev/null 2>&1 || true' EXIT

for attempt in $(seq 1 30); do
if curl -fsS http://127.0.0.1:3000/api/health >/dev/null; then
exit 0
fi
sleep 2
done

docker logs link-test
exit 1
53 changes: 53 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build and Push Docker Image

on:
release:
types:
- published

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
27 changes: 27 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: PR Checks

on:
pull_request:
workflow_dispatch:

jobs:
quality:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Build
run: bun run build

- name: Test
run: bun test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.playwright
.playwright-cli

.data

# dependencies (bun install)
Expand Down
8 changes: 0 additions & 8 deletions .playwright/cli.config.json

This file was deleted.

9 changes: 9 additions & 0 deletions .vscode/mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"servers": {
"link": {
"url": "http://localhost:3000/mcp",
"type": "http"
}
},
"inputs": []
}
5 changes: 5 additions & 0 deletions bun-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ declare module "*.module.css" {
const classes: { readonly [key: string]: string };
export = classes;
}

declare module "*.css" {
const contents: string;
export = contents;
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"dev": "bun --hot src/index.ts",
"start": "NODE_ENV=production bun src/index.ts",
"build": "bun run build.ts",
"build": "bun run typecheck && bun run build.ts",
"typecheck": "bunx tsc -p tsconfig.json --noEmit",
"test": "bun test"
},
"dependencies": {
Expand Down
Loading