Skip to content

Commit 151206d

Browse files
committed
Twerkflows
1 parent 2b75c98 commit 151206d

7 files changed

Lines changed: 496 additions & 8 deletions

File tree

.dockerignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
node_modules
22
drawio
3-
!drawio/src/main/webapp/index.html
43
dist
4+
recordings
5+
scripts
6+
demo.gif
7+
.github

.github/workflows/ci.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
# Restrict all jobs to read-only by default; grant write only where needed.
10+
permissions:
11+
contents: read
12+
13+
env:
14+
REGISTRY: ghcr.io
15+
IMAGE_NAME: ${{ github.repository }}
16+
17+
jobs:
18+
test:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
22+
23+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
24+
with:
25+
node-version: '20'
26+
cache: 'npm'
27+
28+
- run: npm ci
29+
- run: npm test
30+
31+
build-and-push:
32+
needs: test
33+
runs-on: ubuntu-latest
34+
# Only push the image on pushes to main, not on PRs
35+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
36+
permissions:
37+
contents: read
38+
packages: write
39+
40+
steps:
41+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
42+
43+
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
44+
45+
- name: Log in to GitHub Container Registry
46+
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
47+
with:
48+
registry: ${{ env.REGISTRY }}
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Extract image metadata
53+
id: meta
54+
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
55+
with:
56+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
57+
tags: |
58+
type=sha,prefix=
59+
type=raw,value=latest,enable={{is_default_branch}}
60+
61+
- name: Build and push Docker image
62+
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
63+
with:
64+
context: .
65+
push: true
66+
platforms: linux/amd64,linux/arm64
67+
tags: ${{ steps.meta.outputs.tags }}
68+
labels: ${{ steps.meta.outputs.labels }}
69+
cache-from: type=gha
70+
cache-to: type=gha,mode=max

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Ours
22
drawio/*
3-
!drawio/src/main/webapp/index.html
43

54

65
# Theirs
@@ -108,6 +107,5 @@ dist
108107

109108
# TernJS port file
110109
.tern-port
111-
drawio
112110
test-results
113111
recordings

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Stage 1 — clone draw.io (only the webapp is needed at runtime)
22
FROM alpine/git AS drawio
3-
RUN git clone --depth 1 https://github.com/jgraph/drawio.git /drawio
3+
RUN git clone https://github.com/jgraph/drawio.git /drawio && \
4+
cd /drawio && \
5+
git checkout 907d09cc895ede8f7eeff7adcb2adf7c864dd273
46

57
# Stage 2 — build the JS bundle
68
FROM node:20-alpine AS builder
@@ -26,8 +28,8 @@ COPY --from=builder /app/dist ./dist
2628

2729
# draw.io webapp only (the full repo is ~200MB; the webapp is ~30MB)
2830
COPY --from=drawio /drawio/src/main/webapp ./drawio/src/main/webapp
29-
# Overlay modeld's customized index.html (tracked in git, excluded from drawio clone)
30-
COPY drawio/src/main/webapp/index.html ./drawio/src/main/webapp/index.html
31+
# Overlay modeld's customized index.html
32+
COPY drawio-index.html ./drawio/src/main/webapp/index.html
3133

3234
# MCP server
3335
COPY mcp ./mcp

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: install build test start
1+
.PHONY: install build test ci start
22

33
drawio:
44
git clone https://github.com/jgraph/drawio.git drawio
@@ -12,5 +12,8 @@ build: install
1212
test:
1313
npm test
1414

15+
ci:
16+
act push --job test --container-architecture linux/amd64
17+
1518
start: build
1619
npm start

0 commit comments

Comments
 (0)