-
Notifications
You must be signed in to change notification settings - Fork 2
160 lines (138 loc) · 4.16 KB
/
s3-deploy-development.yml
File metadata and controls
160 lines (138 loc) · 4.16 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Deploy docs to S3 development
on:
push:
branches:
- develop
jobs:
lint-mdx:
name: Lint MDX
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: node scripts/lint-mdx.mjs
build-en:
needs: lint-mdx
runs-on: ubuntu-latest
concurrency:
group: build-en-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Cache Astro build
uses: actions/cache@v4
with:
path: .astro
key: astro-dev-en-${{ github.sha }}
restore-keys: astro-dev-en-
- run: npm ci
env:
PUPPETEER_SKIP_DOWNLOAD: '1'
- name: Build English only
env:
NODE_OPTIONS: --max-old-space-size=8192
run: npm run prebuild && ASTRO_TELEMETRY_DISABLED=1 BUILD_LOCALES=none npx astro build
- name: Generate markdown exports
env:
NODE_OPTIONS: --max-old-space-size=8192
run: npm run build:md:prod
- uses: actions/upload-artifact@v4
with:
name: build-en
path: build/
retention-days: 1
build-locale:
needs: lint-mdx
runs-on: ubuntu-latest
strategy:
matrix:
locale: [zh, tr, ru, es]
concurrency:
group: build-locale-${{ matrix.locale }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Cache Astro build
uses: actions/cache@v4
with:
path: .astro
key: astro-dev-${{ matrix.locale }}-${{ github.sha }}
restore-keys: astro-dev-${{ matrix.locale }}-
- run: npm ci
env:
PUPPETEER_SKIP_DOWNLOAD: '1'
- name: Build locale ${{ matrix.locale }}
env:
NODE_OPTIONS: --max-old-space-size=8192
run: npm run prebuild && ASTRO_TELEMETRY_DISABLED=1 BUILD_LOCALES=${{ matrix.locale }} npx astro build
# Generate locale .md / llms.txt / llms-full.txt exports into
# build/${{ matrix.locale }}/ so they land in the artifact alongside
# the Astro HTML pages.
- name: Generate locale markdown exports
env:
NODE_OPTIONS: --max-old-space-size=8192
BUILD_LOCALES: ${{ matrix.locale }}
run: npm run build:md:prod
- uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.locale }}
path: build/${{ matrix.locale }}/
retention-days: 1
deploy:
needs: [build-en, build-locale]
runs-on: ubuntu-latest
concurrency:
group: deploy-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
environment: development
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build-en
path: build/
- uses: actions/download-artifact@v4
with:
name: build-zh
path: build/zh/
- uses: actions/download-artifact@v4
with:
name: build-tr
path: build/tr/
- uses: actions/download-artifact@v4
with:
name: build-ru
path: build/ru/
- uses: actions/download-artifact@v4
with:
name: build-es
path: build/es/
- name: Deploy
uses: reggionick/s3-deploy@v4
with:
folder: build
bucket: ${{ secrets.S3_BUCKET }}
bucket-region: ${{ secrets.S3_BUCKET_REGION }}
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
invalidation: /*
delete-removed: true
private: true
- name: Update deployment tag
run: |
git tag -f last-development-deploy
git push -f origin last-development-deploy