-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SilverBullet pivot to become an offline-first PWA (#403)
- Loading branch information
Showing
389 changed files
with
4,400 additions
and
291,045 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.git |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Docker S3 | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
tags: | ||
- "*" | ||
env: | ||
DENO_VERSION: v1.33 | ||
# Docker & Registries | ||
ARCHITECTURES: linux/amd64,linux/arm64 | ||
IMAGE_NAME: silverbullet-s3 | ||
NAMESPACE_GITHUB: silverbulletmd | ||
NAMESPACE_DOCKER: zefhemel | ||
jobs: | ||
docker-build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Setup repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU for multi-arch builds with buildx | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: ${{ env.ARCHITECTURES }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
platforms: ${{ env.ARCHITECTURES }} | ||
|
||
- name: Setup Deno | ||
uses: denoland/setup-deno@d4873ceeec10de6275fecd1f94b6985369d40231 | ||
with: | ||
deno-version: ${{ env.DENO_VERSION }} | ||
|
||
- name: Run bundle build | ||
run: | | ||
deno task build | ||
deno task bundle | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Log in to the ghcr Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
# | ||
# MetaData Extract Docu: <https://github.com/docker/metadata-action> | ||
# | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4.4.0 | ||
with: | ||
images: | | ||
# Set the different image names(paces) for docker-hub & ghcr | ||
${{ env.NAMESPACE_DOCKER }}/${{ env.IMAGE_NAME }} | ||
ghcr.io/${{ env.NAMESPACE_GITHUB }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
# <https://github.com/docker/metadata-action#typeref> | ||
# minimal (short sha), enable f desired | ||
# type=sha,enable=true,priority=100,prefix=commit-,suffix=,format=short | ||
# set latest tag for default branch | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
# | ||
# tag w/ full tag part of git tag: <https://github.com/docker/metadata-action#typesemver> | ||
# only present for `on.push.tags` ! | ||
type=semver,pattern={{raw}},enable=true | ||
# type=edge,branch=local # usually this would be the develop branch | ||
- name: Build and push main docker images | ||
uses: docker/build-push-action@v4.0.0 | ||
with: | ||
context: . | ||
platforms: ${{ env.ARCHITECTURES }} | ||
push: true | ||
file: Dockerfile.s3 | ||
# Disable to get rid of unknown architecture in ghcr | ||
provenance: false | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Build & Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup repo | ||
uses: actions/checkout@v3 | ||
- name: Setup Deno | ||
uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: v1.33 | ||
- name: Run build | ||
run: deno task build | ||
- name: Bundle | ||
run: deno task bundle | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
draft: true | ||
files: | | ||
website/CHANGELOG.md | ||
dist/silverbullet.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
pages | ||
test_space | ||
.DS_Store | ||
dist_bundle | ||
dist_client_bundle | ||
dist_plug_bundle | ||
dist | ||
*.js.map | ||
website_build | ||
data.db* | ||
publish-data.db | ||
/index.json | ||
.idea | ||
deno.lock | ||
node_modules | ||
fly.toml | ||
env.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This Dockerfile is used to build a Docker image that runs silverbullet with an S3 bucket as a backend | ||
# Configure it with the following environment variables | ||
|
||
# AWS_ACCESS_KEY_ID=XXXX | ||
# AWS_SECRET_ACCESS_KEY=XXXX | ||
# AWS_ENDPOINT=s3.eu-central-1.amazonaws.com | ||
# AWS_REGION=eu-central-1 | ||
# AWS_BUCKET=my-sb-bucket | ||
|
||
FROM denoland/deno:alpine-1.33.2 | ||
|
||
# Copy the bundled version of silverbullet into the container | ||
ADD ./dist/silverbullet.js /silverbullet.js | ||
|
||
# deno user id is 1000 in alpine image | ||
USER deno | ||
|
||
# Expose port 3000 | ||
# Port map this when running, e.g. with -p 3002:3000 (where 3002 is the host port) | ||
EXPOSE 3000 | ||
|
||
# Run the server, allowing to pass in additional argument at run time, e.g. | ||
# docker run -p 3002:3000 -v myspace:/space -it zefhemel/silverbullet --user me:letmein | ||
ENTRYPOINT deno run -A /silverbullet.js -L 0.0.0.0 s3:// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { denoPlugins, esbuild } from "./plugos/deps.ts"; | ||
|
||
await Deno.mkdir("dist", { recursive: true }); | ||
await esbuild.build({ | ||
entryPoints: { | ||
silverbullet: "silverbullet.ts", | ||
}, | ||
outdir: "dist", | ||
format: "esm", | ||
absWorkingDir: Deno.cwd(), | ||
bundle: true, | ||
treeShaking: true, | ||
sourcemap: false, | ||
minify: false, | ||
plugins: [ | ||
{ | ||
name: "json", | ||
setup: (build) => | ||
build.onLoad({ filter: /\.json$/ }, () => ({ loader: "json" })), | ||
}, | ||
|
||
...denoPlugins({ | ||
importMapURL: new URL("./import_map.json", import.meta.url) | ||
.toString(), | ||
}), | ||
], | ||
}); | ||
const bundleJs = await Deno.readTextFile("dist/silverbullet.js"); | ||
// Patch output JS with import.meta.main override to avoid ESBuild CLI handling | ||
await Deno.writeTextFile( | ||
"dist/silverbullet.js", | ||
"import.meta.main = false;\n" + bundleJs, | ||
); | ||
console.log("Output in dist/silverbullet.js"); | ||
esbuild.stop(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.