-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (120 loc) · 4.84 KB
/
Copy pathdeploy_all.yml
File metadata and controls
129 lines (120 loc) · 4.84 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Deploy All
# Site-wide deploy, and the promotion unit for the whole site: it is the only workflow
# that rebuilds every product AND the bucket-root aggregates together, so production
# never ends up with an index that references pages it has not published.
#
# Runs on demand, and automatically when the shared theme changes (themes/** affects
# every product). Home publishes to the bucket root and runs first.
#
# The target environment(s) come from `resolve_targets.yml` — see that file for the rule.
on:
workflow_dispatch:
inputs:
environment:
description: 'Target environment'
required: true
default: production
type: choice
options:
- staging
- production
push:
branches: [ main ]
paths:
- 'themes/**'
jobs:
targets:
uses: ./.github/workflows/resolve_targets.yml
with:
environment_override: ${{ github.event_name == 'workflow_dispatch' && inputs.environment || '' }}
home:
needs: targets
if: ${{ needs.targets.outputs.environments != '[]' }}
strategy:
# Staging first, and a staging failure stops the production build.
max-parallel: 1
matrix:
environment: ${{ fromJSON(needs.targets.outputs.environments) }}
uses: ./.github/workflows/deploy_product.yml
with:
product_family: home
environment: ${{ matrix.environment }}
# Home publishes the bucket-root files; invalidate the Markdown/llms/404 outputs too,
# not just the HTML (otherwise CloudFront serves a stale /index.md, /llms.txt, /404.html …).
invalidate_paths: '/index.html /index.md /llms.txt /llms-full.txt /404.html'
max_deletes: '0'
secrets: inherit
products:
needs: [targets, home]
if: ${{ needs.targets.outputs.environments != '[]' }}
strategy:
fail-fast: false
matrix:
environment: ${{ fromJSON(needs.targets.outputs.environments) }}
product_family:
- annotation
- assembly
- classification
- comparison
- conversion
- editor
- markdown
- merger
- metadata
- parser
- redaction
- search
- signature
- viewer
- watermark
uses: ./.github/workflows/deploy_product.yml
with:
product_family: ${{ matrix.product_family }}
environment: ${{ matrix.environment }}
secrets: inherit
# Rebuild the bucket-root aggregates from every product's SOURCE — no per-product build
# artifacts needed: the 404 live-search index (/search-index.json) and the combined,
# compacted whole-reference file (/llms-full.txt). Same job runs standalone in
# refresh_search_index.yml on content pushes.
search-index:
needs: [targets, products]
if: ${{ !cancelled() && needs.targets.outputs.environments != '[]' }}
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
environment: ${{ fromJSON(needs.targets.outputs.environments) }}
env:
ENVIRONMENT: ${{ matrix.environment }}
steps:
- uses: actions/checkout@v4
- name: Build search-index.json from source
run: python3 scripts/build_search_index.py --source content/sites/groupdocs --out search-index.json
- name: Deploy search-index.json to bucket root
run: |
BUCKET=${{ env.ENVIRONMENT == 'production' && 'reference.groupdocs.com' || 'reference2.groupdocs.com' }}
aws s3 cp search-index.json "s3://$BUCKET/search-index.json" \
--content-type "application/json; charset=utf-8" --region us-west-2
env:
AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }}
- name: Build llms-full.txt from source
run: |
BASE=${{ env.ENVIRONMENT == 'production' && 'https://reference.groupdocs.com' || 'https://reference2.groupdocs.com' }}
python3 scripts/build_llms_full.py --source content/sites/groupdocs --base-url "$BASE" --out llms-full.txt
- name: Deploy llms-full.txt to bucket root
run: |
BUCKET=${{ env.ENVIRONMENT == 'production' && 'reference.groupdocs.com' || 'reference2.groupdocs.com' }}
aws s3 cp llms-full.txt "s3://$BUCKET/llms-full.txt" \
--content-type "text/plain; charset=utf-8" --region us-west-2
env:
AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }}
- name: Invalidate CloudFront
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ env.ENVIRONMENT == 'production' && secrets.AWS_DISTRIBUTION_PROD || secrets.AWS_DISTRIBUTION }}
PATHS: '/search-index.json /llms-full.txt'
AWS_REGION: 'us-west-2'
AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }}