1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Preview deploys with translations (#37285)

This commit is contained in:
Peter Bengtsson
2023-06-05 12:23:34 -04:00
committed by GitHub
parent d9fde470d5
commit 5f795d075d
3 changed files with 31 additions and 11 deletions

View File

@@ -7,11 +7,6 @@
# #
# [end-readme] # [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 # The assumption here is that a preview build will not
# need these legacy redirects. Only the redirects from # need these legacy redirects. Only the redirects from
# front-matter will be at play. # front-matter will be at play.

View File

@@ -17,6 +17,12 @@ on:
# unlike 'pull_request_target', these only have secrets if the pull # unlike 'pull_request_target', these only have secrets if the pull
# request creator has permission to access secrets. # request creator has permission to access secrets.
pull_request_target: pull_request_target:
types:
# In case someone puts the 'preview-with-translations' label on the PR
- opened
- synchronize
- reopened
- labeled
merge_group: merge_group:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
@@ -28,7 +34,10 @@ on:
description: 'The commit SHA to build' description: 'The commit SHA to build'
type: string type: string
required: true required: true
WITH_TRANSLATIONS:
description: 'With translations'
required: true
type: boolean
permissions: permissions:
contents: read contents: read
deployments: write deployments: write
@@ -153,6 +162,26 @@ jobs:
name: Merge docs-early-access repo's folders name: Merge docs-early-access repo's folders
run: .github/actions-scripts/merge-early-access.sh 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' }} - if: ${{ env.IS_PUBLIC_BUILD == 'true' }}
name: Check out user code to temp directory name: Check out user code to temp directory
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
@@ -188,7 +217,7 @@ jobs:
with: with:
context: . context: .
push: true push: true
target: preview target: ${{ steps.with-translations.outputs.result == 'true' && 'production' || 'preview' }}
tags: ${{ env.DOCKER_IMAGE }} tags: ${{ env.DOCKER_IMAGE }}
# we only pull the `main` cache image # we only pull the `main` cache image
cache-from: type=registry,ref=${{ secrets.NONPROD_REGISTRY_SERVER }}/${{ github.repository }}:main-preview cache-from: type=registry,ref=${{ secrets.NONPROD_REGISTRY_SERVER }}/${{ github.repository }}:main-preview

View File

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