docs: deploy: switch to docusaurus based deploys

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-06-02 15:36:43 -07:00
parent c95b5d2bae
commit a949bbf157
2 changed files with 13 additions and 87 deletions

View File

@ -1,95 +1,23 @@
package main package main
import ( import (
"encoding/json"
"dagger.io/dagger" "dagger.io/dagger"
"dagger.io/os"
"dagger.io/js/yarn" "dagger.io/js/yarn"
"dagger.io/git" "dagger.io/netlify"
"dagger.io/docker"
"dagger.io/aws"
"dagger.io/aws/s3"
) )
// dagger repository // dagger repository
repository: dagger.#Artifact @dagger(input) repository: dagger.#Artifact @dagger(input)
// docs version
version: string | *"devel" @dagger(input)
// if repository is checked out at a tag, use it as the version
tag: git.#CurrentBranch & {
"repository": repository
}
if (tag.name & =~"^v") != _|_ {
version: tag.name
}
// AWS credentials
awsConfig: aws.#Config @dagger(input)
// Lint the markdowns
lint: os.#Container & {
image: docker.#Pull & {
from: "tmknom/markdownlint:0.23.1"
}
command: "markdownlint ./docs"
dir: "/src"
mount: "/src": from: repository
}
// Build the docs website // Build the docs website
docs: yarn.#Package & { docs: yarn.#Package & {
source: repository source: repository
cwd: "./tools/gendocs" cwd: "tools/daggosaurus/"
buildDir: "./tools/gendocs/public" buildDir: "tools/daggosaurus/build"
args: ["--prefix-paths"]
env: VERSION: version
} }
// Upload to S3 // Deploy the docs website
website: s3.#Sync & { site: netlify.#Site & {
config: awsConfig name: string | *"docs-dagger-io" @dagger(input)
source: docs.build contents: docs.build
delete: true
target: "s3://docs.dagger.io/\(version)/"
}
// generate and upload a `tags.json` file for the navbar version selector
tags: git.#Tags & {
"repository": repository
}
versions: [ for name in tags.tags {tag: name}, {
tag: "devel"
}]
versionsObject: s3.#Put & {
config: awsConfig
sourceInline: json.Marshal(versions)
contentType: "application/json"
target: "s3://docs.dagger.io/tags.json"
}
// if we're building a release, redirect the docs website to this page
if version != "devel" {
redirect: s3.#Put & {
config: awsConfig
sourceInline: #"""
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=/\#(version)">
</head>
<body>
Nothing to see here; <a href="/\#(version)">see the latest version of the docs</a>.
</body>
</html>
"""#
contentType: "text/html"
target: "s3://docs.dagger.io/index.html"
}
} }

View File

@ -1,11 +1,5 @@
name: docs name: docs
inputs: inputs:
awsConfig.accessKey:
secret: ENC[AES256_GCM,data:/KR+mkBb51etyZqiQnl4kxIl4vw=,iv:lFBuaqK9MVr5fYGMM8bN/XyZ9/oUInDWvzhYuK8Yj20=,tag:sHwcSTJ1lKzIDRYzr4Z/yg==,type:str]
awsConfig.region:
text: us-east-1
awsConfig.secretKey:
secret: ENC[AES256_GCM,data:0bHcnNwbKR2F+PKB/Xzs06zsvJHENPZHEcx9SUN3Sn2/fzf0fA2G2w==,iv:A306R2ldjigteL6c0jkvOxZbHtxhlobP2FuPknuf+N4=,tag:CvDqdrej34Kbh8Y7zG5O8Q==,type:str]
repository: repository:
dir: dir:
path: . path: .
@ -13,6 +7,10 @@ inputs:
- '**/node_modules' - '**/node_modules'
- cmd/dagger/dagger - cmd/dagger/dagger
- cmd/dagger/dagger-debug - cmd/dagger/dagger-debug
site.account.name:
text: blocklayer
site.account.token:
secret: ENC[AES256_GCM,data:jPJ8N6cAmtYnQh2SyhM9bQGfkhz777S4fyPDm2YhujwgXH6EogN2Uyw6Ew==,iv:gDchoJYLdQ8IPxrUUIsQ9s2f12JOhh7p573DwOIV2zE=,tag:okatHyjVGPGNOt+aw4iUHg==,type:str]
sops: sops:
kms: [] kms: []
gcp_kms: [] gcp_kms: []
@ -28,8 +26,8 @@ sops:
ejRKQXNFZzBTbUxpc05acnkxQ2U2UkEKX1byNj64xOiRGAJ9lwh55d/mlasI3H6H ejRKQXNFZzBTbUxpc05acnkxQ2U2UkEKX1byNj64xOiRGAJ9lwh55d/mlasI3H6H
b+o3HbXSbV0G0UwQxEOisntR6o27ry/l12ai/sOQ4f9MXm6FRw2XTg== b+o3HbXSbV0G0UwQxEOisntR6o27ry/l12ai/sOQ4f9MXm6FRw2XTg==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----
lastmodified: "2021-05-29T02:37:17Z" lastmodified: "2021-06-02T22:14:46Z"
mac: ENC[AES256_GCM,data:mXlkcR6U0sQwXdk4mYMKmA6/tcZWVtQt76RVfYOj3uE89XgIUQhk5qts/fp8DMpOB90KZtUJB2Im2+ppqdhtKQO2xcp0Cj6WN1omYRdGbSAMBMPtIbbAdzMcZwvCScRvfDn1ecCSeHikTpDlvUImmoOJLH4ItvLq7JK3oUgPvUs=,iv:ckI70eAguY4p8eTI2W5Iws1zYaqkZuHcNWwjGBjbVYk=,tag:/hoRjWxK/5oxbmia4TgcKA==,type:str] mac: ENC[AES256_GCM,data:x/Up/GCLTwIWSbyxvy3S79j4gbKRRYnDguvgPJFAii2PS6rjSU7KHtwM9WbUqQtd+NDbe1eWjdmAC4jPwVsa9OY7s+heR3597OpTh0pHcOgTrc4fTVN9IVHwehlg4hJU00iL1oiiHfeCD5dMUGeIRyqRqoAyMJrPdC9IDwjnp6E=,iv:IUbrkPQqLC/wnfKZMnOK9jKSc+xDXpeJwKLXuioifyE=,tag:2l+FhV3k5WvhQyvvf37Hjw==,type:str]
pgp: [] pgp: []
encrypted_suffix: secret encrypted_suffix: secret
version: 3.7.1 version: 3.7.1