From e3ba11c2b351d332cada2b4a2715373d547b2f97 Mon Sep 17 00:00:00 2001 From: BennyDB <74614235+BennyDeBock@users.noreply.github.com> Date: Fri, 6 May 2022 15:06:02 +0200 Subject: [PATCH] Enhancement/deploy to s3 - Add deployment to S3 * Create deployment stack file for cloudformation * Add deployment script * Add custom 404 page * Install couscous manually in deploy workflow * Add missing sudo statement to chmod command * Add project board workflow (#649) * Add i18n Support (#650) * Add i18n support * Update requirements.txt to include i18n package * Update Readme to include explanation for contributing * Update styling and include mistakes section * Apply suggestions from code review * Update per PR changes Co-authored-by: Tim Condon <0xTim@users.noreply.github.com> * Remove plugin for now * Reenable plugin * Plugin broke search * Update mkdocs material requirement to be version 7.1 or higher * remove google analytics. Use highlight for code blocks. Include search in plugins * Add css file for code block customisation possiblities Co-authored-by: Tim Condon <0xTim@users.noreply.github.com> --- .github/workflows/deploy.yml | 69 +- 4.0/docs/stylesheets/extra.css | 20 + 4.0/mkdocs.yml | 65 +- 4.0/theme/404.html | 1357 ++++++++++++++++++++++++++++++++ requirements.txt | 2 +- stack.yml | 72 ++ 6 files changed, 1541 insertions(+), 44 deletions(-) create mode 100644 4.0/docs/stylesheets/extra.css create mode 100644 4.0/theme/404.html create mode 100644 stack.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 968fa635..5d74c92c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,17 +1,62 @@ -name: deploy +name: Build and deploy the Vapor documentation on: push: branches: - main jobs: - deploy: - name: docs.vapor.codes - runs-on: ubuntu-latest - steps: - - name: Deploy docs - uses: appleboy/ssh-action@master - with: - host: vapor.codes - username: vapor - key: ${{ secrets.VAPOR_CODES_SSH_KEY }} - script: ./github-actions/deploy-docs.sh + deploy: + name: Build and deploy + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Install dependencies + run: | + composer global require couscous/couscous + pip install -r requirements.txt + + curl -OSL https://couscous.io/couscous.phar + sudo chmod +x couscous.phar + sudo mv couscous.phar /usr/local/bin/couscous + - name: Build the website + run: | + bash ./build.sh + - name: Configure AWS credentials + id: cred + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.DOCS_DEPLOYER_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.DOCS_DEPLOYER_AWS_SECRET_ACCESS_KEY }} + aws-region: 'eu-west-2' + - name: Deploy to AWS Cloudformation + id: clouddeploy + if: steps.cred.outcome == 'success' + uses: aws-actions/aws-cloudformation-github-deploy@v1.0.3 + with: + name: vapor-docs-stack + template: stack.yml + no-fail-on-empty-changeset: "1" + parameter-overrides: >- + DomainName=docs.vapor.codes, + S3BucketName=vapor-docs-site, + AcmCertificateArn=${{ secrets.CERTIFICATE_ARN }} + - name: Deploy to S3 + id: s3deploy + if: steps.clouddeploy.outcome == 'success' + uses: jakejarvis/s3-sync-action@master + with: + args: --acl public-read --follow-symlinks --delete + env: + AWS_S3_BUCKET: 'vapor-docs-site' + AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_DEPLOYER_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_DEPLOYER_AWS_SECRET_ACCESS_KEY }} + AWS_REGION: 'eu-west-2' + SOURCE_DIR: 'site' + - name: Invalidate CloudFront + uses: awact/cloudfront-action@master + env: + SOURCE_PATH: '/*' + AWS_REGION: 'eu-west-2' + AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_DEPLOYER_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_DEPLOYER_AWS_SECRET_ACCESS_KEY }} + DISTRIBUTION_ID: ${{ secrets.DOCS_DISTRIBUTION_ID }} diff --git a/4.0/docs/stylesheets/extra.css b/4.0/docs/stylesheets/extra.css new file mode 100644 index 00000000..2c6fe258 --- /dev/null +++ b/4.0/docs/stylesheets/extra.css @@ -0,0 +1,20 @@ +/* +:root > * { + --md-code-hl-number-color: #FF0000; + --md-code-hl-special-color: #FF0000; + --md-code-hl-function-color: #FF0000; + --md-code-hl-constant-color: #FF0000; + --md-code-hl-keyword-color: #FF0000; + --md-code-hl-string-color: #FF0000; + --md-code-hl-name-color: #FF0000; + --md-code-hl-operator-color: #FF0000; + --md-code-hl-punctuation-color: #FF0000; + --md-code-hl-comment-color: #FF0000; + --md-code-hl-generic-color: #FF0000; + --md-code-hl-variable-color: #FF0000; + + --md-code-fg-color: #FF0000; + --md-code-bg-color: #FF0000; + --md-code-hl-color: #FF0000; +} +*/ \ No newline at end of file diff --git a/4.0/mkdocs.yml b/4.0/mkdocs.yml index d80e3078..555bf87b 100644 --- a/4.0/mkdocs.yml +++ b/4.0/mkdocs.yml @@ -43,46 +43,49 @@ extra: - icon: fontawesome/brands/github link: https://github.com/vapor -# Google Analytics -google_analytics: - - UA-76177358-4 - - auto +# Custom code highlighting syntax (uncomment if you want to use this. css is in `docs/stylesheets/extra.css`) +# extra_css: +# - stylesheets/extra.css # Extensions markdown_extensions: - admonition - - codehilite: - guess_lang: false + - pymdownx.highlight: + use_pygments: false + - pymdownx.inlinehilite + - pymdownx.snippets + - pymdownx.superfences - footnotes - meta - toc: permalink: true -# # Plugins -# plugins: -# # i18n plugin documentation -# # https://github.com/ultrabug/mkdocs-static-i18n -# - i18n: -# default_language: 'en' -# # Add the new languages here. DON'T CHANGE THE DEFAULT LANGUAGE -# languages: -# en: -# name: English -# build: true -# nl: -# name: Nederlands -# site_name: Vapor Documentatie -# build: true -# fr: -# name: Français -# site_name: Documentation Vapor -# build: true -# # Add navigation translations here -# nav_translations: -# nl: -# Welcome: Welkom -# fr: -# Welcome: Bienvenue +# Plugins +plugins: + - search + # i18n plugin documentation + # https://github.com/ultrabug/mkdocs-static-i18n + - i18n: + default_language: 'en' + # Add the new languages here. DON'T CHANGE THE DEFAULT LANGUAGE + languages: + en: + name: English + build: true + nl: + name: Nederlands + site_name: Vapor Documentatie + build: true + fr: + name: Français + site_name: Documentation Vapor + build: true + # Add navigation translations here + nav_translations: + nl: + Welcome: Welkom + fr: + Welcome: Bienvenue nav: diff --git a/4.0/theme/404.html b/4.0/theme/404.html new file mode 100644 index 00000000..30b81dd8 --- /dev/null +++ b/4.0/theme/404.html @@ -0,0 +1,1357 @@ + + + + + + + + + + + + + + + + + + + + Vapor Docs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+ +

404 - Page not found

+

The page you are looking for may have been removed, changed in name, or it is temporarily unavailable. Please try again later.

+ +
+
+
+ +
+ + + +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 41de784f..b6eddcf5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,7 @@ # Direct dependencies mkdocs>=1 -mkdocs-material>=3 +mkdocs-material>=7.1.0 Pygments>=2.2 pymdown-extensions>=4.11 mkdocs-static-i18n>=0.45 diff --git a/stack.yml b/stack.yml new file mode 100644 index 00000000..051f8e0f --- /dev/null +++ b/stack.yml @@ -0,0 +1,72 @@ +AWSTemplateFormatVersion: '2010-09-09' +Description: 'The documentation for Vapor' +Parameters: + DomainName: + Type: String + Description: The domain name for the site + AllowedPattern: (?!-)[a-zA-Z0-9-.]{1,63}(?