Skip to content

Commit 0a87083

Browse files
committed
TCLOUD-4860: Create a workflow for releasing docs
1 parent ece2fa1 commit 0a87083

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Deploy Tiny Docs v2
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
environment:
7+
description: 'Deployment Environment'
8+
required: true
9+
default: 'staging'
10+
type: choice
11+
options:
12+
- 'staging'
13+
- 'production'
14+
15+
env:
16+
ACCT: ${{ inputs.environment == 'production' && '990880627107' || '327995277200' }}
17+
BUCKET: ${{ inputs.environment == 'production' && 'tiny-cloud-antora-docs-release' || 'tiny-cloud-antora-docs-preview' }}
18+
RUN: run-${{ github.run_number }}-${{ github.run_attempt }}
19+
20+
jobs:
21+
build:
22+
name: Build Docs and Deploy
23+
24+
if: github.repository == 'tinymce/tinymce-docs' && github.repository_owner == 'tinymce'
25+
26+
runs-on: ubuntu-latest
27+
28+
defaults:
29+
run:
30+
shell: bash
31+
32+
steps:
33+
- name: Checkout branch
34+
uses: actions/checkout@v5
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v5
38+
with:
39+
cache: 'yarn'
40+
node-version: 24
41+
42+
- name: Install dependencies
43+
run: yarn install
44+
45+
- name: Build Website
46+
run: yarn antora ./antora-playbook.yml
47+
48+
- name: Rename site folder to docs
49+
run: |
50+
mv ./build/site ./build/docs
51+
52+
- name: Rename sitemap.xml to antora-sitemap.xml
53+
run: |
54+
mv ./build/docs/sitemap.xml ./build/docs/antora-sitemap.xml
55+
56+
- name: configure aws credentials
57+
uses: aws-actions/[email protected]
58+
with:
59+
role-to-assume: 'arn:aws:iam::${{ env.ACCT }}:role/${{ inputs.environment }}-tinymce-docs-update'
60+
role-session-name: tinymce-docs-${{ inputs.environment }}-release
61+
aws-region: us-east-1
62+
63+
- name: Upload website preview to S3
64+
run: |
65+
aws s3 sync ./build s3://${BUCKET}/main/${RUN}
66+
67+
- name: Create redirects on S3
68+
uses: tinymce/[email protected]
69+
with:
70+
build: ./build/
71+
redirects: ./redirects.json
72+
bucket: ${{ env.BUCKET }}
73+
prefix: main/${{ env.RUN }}
74+
parallel: 10
75+
76+
- name: Update pointer to current run output
77+
run: |
78+
aws s3api put-object --bucket ${BUCKET} --key main/index.html --body .github/workflows/resources/empty.html --content-type text/html --metadata pointer=${RUN}
79+
80+
- name: Tag old versions for cleanup
81+
uses: tinymce/[email protected]
82+
with:
83+
bucket: ${{ env.BUCKET }}
84+
folder: main
85+
parallel: 20

0 commit comments

Comments
 (0)