Skip to content

Deploy Tiny Docs

Deploy Tiny Docs #2

Workflow file for this run

name: Deploy Tiny Docs
on:
workflow_dispatch:
inputs:
environment:
description: 'Deployment Environment'
required: true
default: 'staging'
type: choice
options:
- 'staging'
- 'production'
jobs:
build:
name: Build Docs and Deploy
if: github.repository == 'tinymce/tinymce-docs' && github.repository_owner == 'tinymce'
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [21]
steps:
- uses: actions/checkout@v1
- name: Use Node.js
uses: actions/setup-node@v2
with:
cache: 'yarn'
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn install
- name: Build Website
run: yarn antora ./antora-playbook.yml
- name: Rename sitemap.xml
shell: bash
run: |
mv ./build/site/sitemap.xml ./build/site/antora-sitemap.xml
- name: Upload website to S3 and Invalidate Cache
if: inputs.environment == 'staging'
run: |
aws s3 sync --acl=public-read --delete ./build/site s3://docs-feature-6-doc-2324.staging.tiny.cloud/docs
aws cloudfront create-invalidation --distribution-id E7DUUPEI08HNW --paths "/docs/*"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.STAGING_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.STAGING_AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true
- name: Upload website to S3 and Invalidate Cache
if: inputs.environment == 'production'
run: |
aws cloudfront create-invalidation --distribution-id E3LFU502SQ5UR --paths "/docs/*"
aws s3 sync --acl=public-read --delete ./build/site s3://docs-feature-7-doc-2324.staging.tiny.cloud/docs
env:
AWS_ACCESS_KEY_ID: ${{ secrets.PRODUCTION_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PRODUCTION_AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true