docs: switch release flow to dagger
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
a949bbf157
commit
335e2f7c24
2
.dagger/env/docs/plan/main.cue
vendored
2
.dagger/env/docs/plan/main.cue
vendored
@ -18,6 +18,6 @@ docs: yarn.#Package & {
|
|||||||
|
|
||||||
// Deploy the docs website
|
// Deploy the docs website
|
||||||
site: netlify.#Site & {
|
site: netlify.#Site & {
|
||||||
name: string | *"docs-dagger-io" @dagger(input)
|
name: string | *"docs-dagger-io" @dagger(input)
|
||||||
contents: docs.build
|
contents: docs.build
|
||||||
}
|
}
|
||||||
|
72
.github/workflows/docs.yml
vendored
72
.github/workflows/docs.yml
vendored
@ -2,8 +2,6 @@ name: Docs
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
tags:
|
||||||
- v*
|
- v*
|
||||||
paths:
|
paths:
|
||||||
@ -15,75 +13,11 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_AWS_SECRET_ACCESS_KEY }}
|
|
||||||
AWS_DEFAULT_REGION: "us-east-1"
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set Version
|
|
||||||
id: vars
|
|
||||||
run: |
|
|
||||||
tag=${GITHUB_REF#refs/*/}
|
|
||||||
[ "$tag" = "main" ] && echo ::set-output name=tag::devel || echo ::set-output name=tag::$tag
|
|
||||||
|
|
||||||
# fetch-depth: '0' enables listing all tags for version selector
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: "0"
|
fetch-depth: "0"
|
||||||
|
- uses: dagger/dagger-action@v1
|
||||||
#################################################################
|
|
||||||
# BUILD SITE
|
|
||||||
#################################################################
|
|
||||||
|
|
||||||
# Install Node
|
|
||||||
- uses: actions/setup-node@v2
|
|
||||||
with:
|
with:
|
||||||
node-version: "14"
|
age-key: ${{ secrets.DAGGER_AGE_KEY }}
|
||||||
- run: yarn --cwd ./tools/gendocs
|
args: up -e docs
|
||||||
- name: Build Site
|
|
||||||
run: yarn --cwd ./tools/gendocs build --prefix-paths
|
|
||||||
env:
|
|
||||||
VERSION: ${{steps.vars.outputs.tag}}
|
|
||||||
|
|
||||||
#################################################################
|
|
||||||
# DEPLOY TO S3
|
|
||||||
#################################################################
|
|
||||||
|
|
||||||
# deploy the site in the right foder ( tag or devel)
|
|
||||||
- name: S3 Sync
|
|
||||||
uses: ItsKarma/aws-cli@v1.70.0
|
|
||||||
with:
|
|
||||||
args: s3 sync --delete ./tools/gendocs/public/ s3://docs.dagger.io/${{steps.vars.outputs.tag}}/
|
|
||||||
|
|
||||||
# list All Tags in json file for version selector
|
|
||||||
# upload to /tags.json
|
|
||||||
- name: Create tags.json
|
|
||||||
run: echo "[" {\"tag\"':' \"$(git tag -l "v*" | tr '\n' '|' | sed -e 's/|/"}, {\"tag\"':' "/g')devel\"} "]" > tags.json
|
|
||||||
- name: Copy tags.json
|
|
||||||
uses: ItsKarma/aws-cli@v1.70.0
|
|
||||||
with:
|
|
||||||
args: s3 cp ./tags.json s3://docs.dagger.io/
|
|
||||||
|
|
||||||
# landing alway on latest tag
|
|
||||||
# use S3 Rediret objet
|
|
||||||
# upload to /docs/index.html
|
|
||||||
- name: Create index.html
|
|
||||||
run: |
|
|
||||||
cat <<EOF > index.html
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="0; url=/${{steps.vars.outputs.tag}}">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
Nothing to see here; <a href="/${{steps.vars.outputs.tag}}">see the
|
|
||||||
latest version of the docs</a>.
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
EOF
|
|
||||||
- name: Copy index.html
|
|
||||||
if: ${{ steps.vars.outputs.tag != 'devel' }}
|
|
||||||
uses: ItsKarma/aws-cli@v1.70.0
|
|
||||||
with:
|
|
||||||
args: s3 cp --cache-control max-age=0 ./index.html s3://docs.dagger.io/
|
|
||||||
|
Reference in New Issue
Block a user