-
Notifications
You must be signed in to change notification settings - Fork 221
65 lines (53 loc) · 1.92 KB
/
deploy_docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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