Skip to content

Commit 1df2f76

Browse files
committed
TR translation
1 parent fb9d6a8 commit 1df2f76

31 files changed

Lines changed: 2146 additions & 119 deletions

.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ PUBLIC_ALGOLIA_INDEX_NAME=adapty
55
PUBLIC_ALGOLIA_ANALYTICS_KEY=5e3fd9357b98f9f0d44bab0f0b7634c0
66

77
# Locale-specific Algolia indices
8-
PUBLIC_ALGOLIA_INDEX_NAME_ZH=adapty_zh
8+
PUBLIC_ALGOLIA_INDEX_NAME_ZH=adapty_zh
9+
PUBLIC_ALGOLIA_INDEX_NAME_TR=adapty_tr

.github/workflows/s3-deploy-development.yml

Lines changed: 89 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,106 @@ jobs:
1717
- run: npm install github-slugger
1818
- run: node scripts/check-links/index.mjs --diff --base=last-development-deploy --internal-only
1919

20-
deploy:
20+
build-en:
2121
needs: check-internal-links
2222
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: 20
29+
30+
- name: Cache node_modules
31+
uses: actions/cache@v4
32+
with:
33+
path: node_modules
34+
key: npm-${{ hashFiles('package-lock.json') }}
35+
36+
- name: Cache Astro build
37+
uses: actions/cache@v4
38+
with:
39+
path: .astro
40+
key: astro-dev-en-${{ github.sha }}
41+
restore-keys: astro-dev-en-
42+
43+
- run: npm ci
44+
45+
- name: Build English only
46+
run: ASTRO_TELEMETRY_DISABLED=1 BUILD_LOCALES=none astro build
47+
48+
- name: Generate markdown exports
49+
run: npm run build:md:prod
50+
51+
- uses: actions/upload-artifact@v4
52+
with:
53+
name: build-en
54+
path: build/
55+
retention-days: 1
56+
57+
build-locale:
58+
needs: check-internal-links
59+
runs-on: ubuntu-latest
60+
strategy:
61+
matrix:
62+
locale: [zh, tr]
63+
steps:
64+
- uses: actions/checkout@v4
65+
66+
- uses: actions/setup-node@v4
67+
with:
68+
node-version: 20
69+
70+
- name: Cache node_modules
71+
uses: actions/cache@v4
72+
with:
73+
path: node_modules
74+
key: npm-${{ hashFiles('package-lock.json') }}
75+
76+
- name: Cache Astro build
77+
uses: actions/cache@v4
78+
with:
79+
path: .astro
80+
key: astro-dev-${{ matrix.locale }}-${{ github.sha }}
81+
restore-keys: astro-dev-${{ matrix.locale }}-
82+
83+
- run: npm ci
84+
85+
- name: Build locale ${{ matrix.locale }}
86+
run: ASTRO_TELEMETRY_DISABLED=1 BUILD_LOCALES=${{ matrix.locale }} astro build
87+
88+
- uses: actions/upload-artifact@v4
89+
with:
90+
name: build-${{ matrix.locale }}
91+
path: build/${{ matrix.locale }}/
92+
retention-days: 1
93+
94+
deploy:
95+
needs: [build-en, build-locale]
96+
runs-on: ubuntu-latest
2397
permissions:
2498
contents: write
2599
environment: development
26100
env:
27101
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
28102
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
29103
steps:
30-
- uses: actions/checkout@v3
104+
- uses: actions/checkout@v4
31105

32-
- name: Install dependencies
33-
run: npm ci
106+
- uses: actions/download-artifact@v4
107+
with:
108+
name: build-en
109+
path: build/
34110

35-
- name: Build
36-
run: ASTRO_TELEMETRY_DISABLED=1 npm run build
111+
- uses: actions/download-artifact@v4
112+
with:
113+
name: build-zh
114+
path: build/zh/
115+
116+
- uses: actions/download-artifact@v4
117+
with:
118+
name: build-tr
119+
path: build/tr/
37120

38121
- name: Deploy
39122
uses: reggionick/s3-deploy@v4
@@ -44,9 +127,7 @@ jobs:
44127
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
45128
invalidation: /*
46129
delete-removed: true
47-
# no-cache: true
48130
private: true
49-
# files-to-include: '{.*/**,**}'
50131

51132
- name: Update deployment tag
52133
run: |

.github/workflows/s3-deploy-production.yml

Lines changed: 203 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,40 @@ on:
77
workflows: ["Translate docs"]
88
types: [completed]
99
branches: [main]
10+
1011
jobs:
12+
# ──────────────────────────────────────────────────────────────
13+
# Determine whether this is a translation-only deploy
14+
# ──────────────────────────────────────────────────────────────
15+
classify:
16+
runs-on: ubuntu-latest
17+
if: github.event_name == 'push' || github.event.workflow_run.conclusion == 'success'
18+
outputs:
19+
translation_only: ${{ steps.check.outputs.translation_only }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 2
24+
- id: check
25+
run: |
26+
if [ "${{ github.event_name }}" = "workflow_run" ]; then
27+
echo "translation_only=true" >> $GITHUB_OUTPUT
28+
else
29+
# Check if the commit is a translation-only commit (from the bot)
30+
AUTHOR=$(git log -1 --pretty=format:'%an')
31+
MSG=$(git log -1 --pretty=format:'%s')
32+
if [[ "$AUTHOR" == "github-actions[bot]" && "$MSG" == "chore: update translations" ]]; then
33+
echo "translation_only=true" >> $GITHUB_OUTPUT
34+
else
35+
echo "translation_only=false" >> $GITHUB_OUTPUT
36+
fi
37+
fi
38+
1139
check-internal-links:
1240
name: Check internal links
41+
needs: classify
42+
if: needs.classify.outputs.translation_only == 'false'
1343
runs-on: ubuntu-latest
14-
if: github.event_name == 'push' || github.event.workflow_run.conclusion == 'success'
1544
steps:
1645
- uses: actions/checkout@v4
1746
with:
@@ -22,23 +51,109 @@ jobs:
2251
- run: npm install github-slugger
2352
- run: node scripts/check-links/index.mjs --diff --base=last-production-deploy --internal-only
2453

25-
deploy:
54+
# ──────────────────────────────────────────────────────────────
55+
# Full deploy: English + all locales (on content pushes)
56+
# ──────────────────────────────────────────────────────────────
57+
build-en:
58+
needs: check-internal-links
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
63+
- uses: actions/setup-node@v4
64+
with:
65+
node-version: 20
66+
67+
- name: Cache node_modules
68+
uses: actions/cache@v4
69+
with:
70+
path: node_modules
71+
key: npm-${{ hashFiles('package-lock.json') }}
72+
73+
- name: Cache Astro build
74+
uses: actions/cache@v4
75+
with:
76+
path: .astro
77+
key: astro-en-${{ github.sha }}
78+
restore-keys: astro-en-
79+
80+
- run: npm ci
81+
82+
- name: Build English only
83+
run: ASTRO_TELEMETRY_DISABLED=1 BUILD_LOCALES=none astro build
84+
85+
- name: Generate markdown exports
86+
run: npm run build:md:prod
87+
88+
- uses: actions/upload-artifact@v4
89+
with:
90+
name: build-en
91+
path: build/
92+
retention-days: 1
93+
94+
build-locale-full:
2695
needs: check-internal-links
2796
runs-on: ubuntu-latest
97+
strategy:
98+
matrix:
99+
locale: [zh, tr]
100+
steps:
101+
- uses: actions/checkout@v4
102+
103+
- uses: actions/setup-node@v4
104+
with:
105+
node-version: 20
106+
107+
- name: Cache node_modules
108+
uses: actions/cache@v4
109+
with:
110+
path: node_modules
111+
key: npm-${{ hashFiles('package-lock.json') }}
112+
113+
- name: Cache Astro build
114+
uses: actions/cache@v4
115+
with:
116+
path: .astro
117+
key: astro-${{ matrix.locale }}-${{ github.sha }}
118+
restore-keys: astro-${{ matrix.locale }}-
119+
120+
- run: npm ci
121+
122+
- name: Build locale ${{ matrix.locale }}
123+
run: ASTRO_TELEMETRY_DISABLED=1 BUILD_LOCALES=${{ matrix.locale }} astro build
124+
125+
- uses: actions/upload-artifact@v4
126+
with:
127+
name: build-${{ matrix.locale }}
128+
path: build/${{ matrix.locale }}/
129+
retention-days: 1
130+
131+
deploy-full:
132+
needs: [build-en, build-locale-full]
133+
runs-on: ubuntu-latest
28134
permissions:
29135
contents: write
30136
environment: production
31137
env:
32138
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
33139
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
34140
steps:
35-
- uses: actions/checkout@v3
141+
- uses: actions/checkout@v4
36142

37-
- name: Install dependencies
38-
run: npm ci
143+
- uses: actions/download-artifact@v4
144+
with:
145+
name: build-en
146+
path: build/
147+
148+
- uses: actions/download-artifact@v4
149+
with:
150+
name: build-zh
151+
path: build/zh/
39152

40-
- name: Build
41-
run: ASTRO_TELEMETRY_DISABLED=1 npm run build
153+
- uses: actions/download-artifact@v4
154+
with:
155+
name: build-tr
156+
path: build/tr/
42157

43158
- name: Deploy
44159
uses: reggionick/s3-deploy@v4
@@ -49,9 +164,88 @@ jobs:
49164
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
50165
invalidation: /*
51166
delete-removed: true
52-
# no-cache: true
53167
private: true
54-
# files-to-include: '{.*/**,**}'
168+
169+
- name: Update deployment tag
170+
run: |
171+
git tag -f last-production-deploy
172+
git push -f origin last-production-deploy
173+
174+
# ──────────────────────────────────────────────────────────────
175+
# Translation-only deploy: build + upload only locale dirs
176+
# ──────────────────────────────────────────────────────────────
177+
build-locale-only:
178+
needs: classify
179+
if: needs.classify.outputs.translation_only == 'true'
180+
runs-on: ubuntu-latest
181+
strategy:
182+
matrix:
183+
locale: [zh, tr]
184+
steps:
185+
- uses: actions/checkout@v4
186+
187+
- uses: actions/setup-node@v4
188+
with:
189+
node-version: 20
190+
191+
- name: Cache node_modules
192+
uses: actions/cache@v4
193+
with:
194+
path: node_modules
195+
key: npm-${{ hashFiles('package-lock.json') }}
196+
197+
- name: Cache Astro build
198+
uses: actions/cache@v4
199+
with:
200+
path: .astro
201+
key: astro-${{ matrix.locale }}-${{ github.sha }}
202+
restore-keys: astro-${{ matrix.locale }}-
203+
204+
- run: npm ci
205+
206+
- name: Build locale ${{ matrix.locale }}
207+
run: ASTRO_TELEMETRY_DISABLED=1 BUILD_LOCALES=${{ matrix.locale }} astro build
208+
209+
- uses: actions/upload-artifact@v4
210+
with:
211+
name: build-tr-only-${{ matrix.locale }}
212+
path: build/${{ matrix.locale }}/
213+
retention-days: 1
214+
215+
deploy-translations:
216+
needs: build-locale-only
217+
runs-on: ubuntu-latest
218+
permissions:
219+
contents: write
220+
environment: production
221+
env:
222+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
223+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
224+
steps:
225+
- uses: actions/checkout@v4
226+
227+
- uses: actions/download-artifact@v4
228+
with:
229+
name: build-tr-only-zh
230+
path: build/zh/
231+
232+
- uses: actions/download-artifact@v4
233+
with:
234+
name: build-tr-only-tr
235+
path: build/tr/
236+
237+
# Sync locale directories to S3 using AWS CLI —
238+
# only overwrites zh/ and tr/ prefixes, leaves English untouched.
239+
- name: Deploy translations to S3
240+
run: |
241+
aws s3 sync build/zh/ s3://${{ secrets.S3_BUCKET }}/zh/ --delete
242+
aws s3 sync build/tr/ s3://${{ secrets.S3_BUCKET }}/tr/ --delete
243+
244+
- name: Invalidate locale paths
245+
run: |
246+
aws cloudfront create-invalidation \
247+
--distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \
248+
--paths "/zh/*" "/tr/*"
55249
56250
- name: Update deployment tag
57251
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ yarn-error.log*
3434
# Translation
3535
.translate-batch-id
3636
src/locales/zh/.hashes/
37+
src/locales/tr/.hashes/
3738

3839
# VSCode
3940
/.vscode/*

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default defineConfig({
8787
react(),
8888
sitemap({
8989
// Exclude localized pages — they are covered by locale-specific sitemaps (e.g. sitemap-zh-index.xml)
90-
filter: (page) => !page.includes('/docs/zh/'),
90+
filter: (page) => !page.includes('/docs/zh/') && !page.includes('/docs/tr/'),
9191
}),
9292
mdx({
9393
remarkPlugins: [remarkHeadingId, remarkDirective, remarkAside, remarkStripImports, remarkStripHighlightComments, remarkTransformRequire, remarkTransformDetails, remarkTransformLinks],

0 commit comments

Comments
 (0)