Preview deploys with translations (#37285)

This commit is contained in:
Peter Bengtsson 2023-06-05 12:23:34 -04:00 коммит произвёл GitHub
Родитель d9fde470d5
Коммит 5f795d075d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 31 добавлений и 11 удалений

Просмотреть файл

@ -7,11 +7,6 @@
#
# [end-readme]
# Translations are never tested in preview environments
# but let's keep the empty directory.
rm -rf translations
mkdir translations
# The assumption here is that a preview build will not
# need these legacy redirects. Only the redirects from
# front-matter will be at play.

Просмотреть файл

@ -17,6 +17,12 @@ on:
# unlike 'pull_request_target', these only have secrets if the pull
# request creator has permission to access secrets.
pull_request_target:
types:
# In case someone puts the 'preview-with-translations' label on the PR
- opened
- synchronize
- reopened
- labeled
merge_group:
workflow_dispatch:
inputs:
@ -28,7 +34,10 @@ on:
description: 'The commit SHA to build'
type: string
required: true
WITH_TRANSLATIONS:
description: 'With translations'
required: true
type: boolean
permissions:
contents: read
deployments: write
@ -153,6 +162,26 @@ jobs:
name: Merge docs-early-access repo's folders
run: .github/actions-scripts/merge-early-access.sh
- name: Determine if we should include translations?
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
id: with-translations
with:
script: |
if (process.env.IS_INTERNAL_BUILD !== 'true') return false
if (context.eventName === "workflow_dispatch") {
return context.payload.inputs.WITH_TRANSLATIONS === 'true'
}
// This works for pull_request_target too
if (context.payload.pull_request?.labels) {
return context.payload.pull_request.labels.map(label => label.name).includes('preview-with-translations')
}
return false
- if: ${{ steps.with-translations.outputs.result == 'true' }}
uses: ./.github/actions/clone-translations
with:
token: ${{ secrets.DOCUBOT_REPO_PAT }}
- if: ${{ env.IS_PUBLIC_BUILD == 'true' }}
name: Check out user code to temp directory
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
@ -188,7 +217,7 @@ jobs:
with:
context: .
push: true
target: preview
target: ${{ steps.with-translations.outputs.result == 'true' && 'production' || 'preview' }}
tags: ${{ env.DOCKER_IMAGE }}
# we only pull the `main` cache image
cache-from: type=registry,ref=${{ secrets.NONPROD_REGISTRY_SERVER }}/${{ github.repository }}:main-preview

Просмотреть файл

@ -61,10 +61,6 @@
{
"name": "WEB_CONCURRENCY",
"value": "1"
},
{
"name": "ENABLED_LANGUAGES",
"value": "en"
}
],
"resources": {