Compare commits

..

1 commit
master ... pr

Author SHA1 Message Date
Sam Therapy 1240719d65
PR
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2022-10-10 23:45:09 +02:00
9 changed files with 114 additions and 59 deletions

View file

@ -3,6 +3,11 @@ type: docker
name: example pipeline
steps:
- name: Build site
image: denoland/deno:alpine
commands:
- deno run -A https://deno.land/x/lume/ci.ts
- name: Staging
image: git.froth.zone/sam/drone-deno-deploy
environment:
@ -14,9 +19,24 @@ steps:
when:
event:
- pull_request
depends_on:
- "Build site"
# - name: Comment on PR
# image: tsakidev/giteacomment:latest
# settings:
# gitea_token:
# from_secret: gitea_token
# gitea_base_url: https://git.froth.zone
# comment_title: "Deno Deploy URL"
# comment_from_file: "/url"
# depends_on:
# - "Staging"
# when:
# event:
# - pull_request
- name: Deploy to Deno Deploy (prod)
image: ghcr.io/samtherapy/deno-deploy:latest
image: git.froth.zone/sam/drone-deno-deploy
environment:
DENO_DEPLOY_TOKEN:
from_secret: DENO_DEPLOY_TOKEN
@ -24,6 +44,8 @@ steps:
project: drone-deploy
entrypoint: server/main.ts
production: true
depends_on:
- "Build site"
when:
branch:
- master

View file

@ -1,28 +0,0 @@
name: ci
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy
uses: samtherapy/deno-deploy@master
with:
deno_deploy_token: ${{ secrets.DENO_DEPLOY_TOKEN }}
entry-point: server/main.ts
project: github-actions-deploy
production: true
env:
ENTRYPOINT: server/main.ts

40
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,40 @@
{
"version": "0.2.0",
"configurations": [
{
"request": "launch",
"type": "pwa-node",
"program": "https:/deno.land/x/lume@v1.5.1/cli.ts",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": [
"run",
"--unstable",
"--import-map=.vscode/lume_import_map.json",
"--inspect",
"--allow-all"
],
"attachSimplePort": 9229,
"name": "Lume build"
},
{
"request": "launch",
"type": "pwa-node",
"program": "https:/deno.land/x/lume@v1.5.1/cli.ts",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": [
"run",
"--unstable",
"--import-map=.vscode/lume_import_map.json",
"--inspect",
"--allow-all"
],
"attachSimplePort": 9229,
"name": "Lume serve",
"args": [
"--serve"
]
}
]
}

8
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,8 @@
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": true,
"deno.suggest.imports.hosts": {
"https://deno.land": true
}
}

View file

@ -1,8 +1,29 @@
# Deploy Example
# deploy_lume_example
This is an example of a simple deployment of a web application using the [Deno Deploy](https://git.froth.zone/actions/deno-deploy) module.
This is an example of a static site generated by the [Lume][lume] static site
generator being deployed to Deno Deploy via GitHub Actions.
It is deployed in two places:
To learn more about static files on Deno Deploy, view this blog post:
https://deno.com/blog/deploy-static-files
- GitHub Actions: <https://github-actions-deploy.deno.dev> ([Action Link](./.github/workflows/deploy.yaml))
- Drone CI: <https://drone-deploy.deno.dev> ([Drone Link](./.drone.yml))
## Development
First, install [Lume][lume].
```shell
deno run -A https://deno.land/x/lume/install.ts
```
Then build the site:
```shell
lume
```
Then start the server:
```shell
deno run -A server/main.ts
```
[lume]: https://lumeland.github.io

View file

@ -1,10 +0,0 @@
{
"deploy": {
"project": "40dfd057-d475-4171-b26e-03d6649edd5e",
"exclude": [
"**/node_modules"
],
"include": [],
"entrypoint": "server/main.ts"
}
}

View file

@ -1,14 +0,0 @@
<html>
<head>
<title>Welcome to my page</title>
<link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.1">
</head>
<body>
<h1>Welcome to my page</h1>
<p>This is an example of a static site generated on Deno Deploy.</p>
<p>The <a href="/api/time">/api/time</a> endpoint dynamically returns the current time.</p>
<p>You can find the source code for this site <a href="https://git.froth.zone/sam/drone-deploy-example">on my Forgejo instance</a>.</p>
</body>
</html>

16
index.njk Normal file
View file

@ -0,0 +1,16 @@
---
title: Welcome to my page
---
<html>
<head>
<title>{{ title }}</title>
</head>
<body>
<h1>{{ title }}</h1>
<p>This is an example of a static site generated by <a href="https://lume.land/">Lume</a> on Deno Deploy.</p>
<p>The <a href="/api/time">/api/time</a> endpoint dynamically returns the current time.</p>
<p>You can find the source code for this site <a href="https://git.froth.zone/sam/drone-deploy-example">on GitHub</a>.</p>
<p>This is an example of a pull request.</p>
</body>
</html>

View file

@ -7,7 +7,7 @@ const app = new Application();
app.use(async (ctx, next) => {
try {
await ctx.send({
root: `${Deno.cwd()}`,
root: `${Deno.cwd()}/_site`,
index: "index.html",
});
} catch {