Deploy Tiny Docs #103
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-latest | |
strategy: | |
matrix: | |
node-version: [21] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
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 Staging S3 and Invalidate Cache | |
if: inputs.environment == 'staging' | |
run: | | |
aws s3 sync --acl=public-read --delete ./build/site s3://tiny-cloud-antora-docs-staging/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 Production S3 and Invalidate Cache | |
if: inputs.environment == 'production' | |
run: | | |
aws s3 sync --acl=public-read --delete ./build/site s3://tiny-cloud-antora-docs-production/docs | |
aws cloudfront create-invalidation --distribution-id E3LFU502SQ5UR --paths "/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 |