Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into ssr2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fiji-flo committed Apr 22, 2024
2 parents 7ffbf3b + 37379ec commit 616a17d
Show file tree
Hide file tree
Showing 32 changed files with 1,525 additions and 746 deletions.
56 changes: 43 additions & 13 deletions .github/workflows/stage-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
DEFAULT_DEPLOYMENT_PREFIX: "main"
DEFAULT_NOTES: ""
DEFAULT_LOG_EACH_SUCCESSFUL_UPLOAD: "false"
DEFAULT_REF: next

on:
schedule:
Expand All @@ -21,6 +22,10 @@ on:

workflow_dispatch:
inputs:
ref:
description: "Branch to deploy (default: next)"
required: false

notes:
description: "Notes"
required: false
Expand Down Expand Up @@ -60,15 +65,52 @@ permissions:
id-token: write

jobs:
trigger:
runs-on: ubuntu-latest
if: ${{ github.repository == 'mdn/yari' && github.event.schedule != '' }}
steps:
# The schedule runs the `main` version, but we want the `next` version.
- run: gh workflow run "${{ github.workflow }}" --repo "${{ github.repository }}" --ref "${{ env.DEFAULT_REF }}"
env:
GH_TOKEN: ${{ secrets.AUTOMERGE_TOKEN }}

build:
environment: stage
runs-on: ubuntu-latest

# Only run the scheduled workflows on the main repo.
if: github.repository == 'mdn/yari'
if: ${{ github.repository == 'mdn/yari' && github.event.schedule == '' }}

steps:
# Our usecase is a bit complicated. When the cron schedule runs this workflow,
# we rely on the env vars defined at the top of the file. But if it's a manual
# trigger we rely on the inputs and only the inputs. That way, the user can
# opt to type in 'false'.
# It's not possible to express this with GitHub Workflow syntax, so we
# have a dedicate set that conveniently sets these as env vars which we
# can refer to later in `if: ....` lines or in bash with the `run: ...` blocks.
- name: Merge dispatch inputs with default env vars
run: |
echo "DEPLOYER_BUCKET_PREFIX=${{ github.event.inputs.deployment_prefix || env.DEFAULT_DEPLOYMENT_PREFIX }}" >> $GITHUB_ENV
echo "DEPLOYER_LOG_EACH_SUCCESSFUL_UPLOAD=${{ github.event.inputs.log_each_successful_upload || env.DEFAULT_LOG_EACH_SUCCESSFUL_UPLOAD }}" >> $GITHUB_ENV
echo "REF=${{ github.event.inputs.ref || env.DEFAULT_REF }}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: ${{ env.REF }}
fetch-depth: 0

- name: Merge main
if: ${{ env.REF != 'main' }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "mdn-bot"
git status
git pull
git checkout main
git status
git checkout -
git merge main --no-edit
- uses: actions/checkout@v4
if: ${{ ! vars.SKIP_BUILD || ! vars.SKIP_FUNCTION }}
Expand All @@ -95,18 +137,6 @@ jobs:
repository: mdn/curriculum
path: mdn/curriculum

# Our usecase is a bit complicated. When the cron schedule runs this workflow,
# we rely on the env vars defined at the top of the file. But if it's a manual
# trigger we rely on the inputs and only the inputs. That way, the user can
# opt to type in 'false'.
# It's not possible to express this with GitHub Workflow syntax, so we
# have a dedicate set that conveniently sets these as env vars which we
# can refer to later in `if: ....` lines or in bash with the `run: ...` blocks.
- name: Merge dispatch inputs with default env vars
run: |
echo "DEPLOYER_BUCKET_PREFIX=${{ github.event.inputs.deployment_prefix || env.DEFAULT_DEPLOYMENT_PREFIX }}" >> $GITHUB_ENV
echo "DEPLOYER_LOG_EACH_SUCCESSFUL_UPLOAD=${{ github.event.inputs.log_each_successful_upload || env.DEFAULT_LOG_EACH_SUCCESSFUL_UPLOAD }}" >> $GITHUB_ENV
- uses: actions/checkout@v4
if: ${{ ! vars.SKIP_BUILD || ! vars.SKIP_FUNCTION }}
with:
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.47.0"
".": "2.49.0"
}
138 changes: 138 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
postProcessSmallerHeadingIDs,
} from "./utils.js";
import { getWebFeatureStatus } from "./web-features.js";
import { rewritePageTitleForSEO } from "./seo.js";
export { default as SearchIndex } from "./search-index.js";
export { gather as gatherGitHistory } from "./git-history.js";
export { buildSPAs } from "./spas.js";
Expand Down Expand Up @@ -536,7 +537,8 @@ export async function buildDocument(
// a breadcrumb in the React component.
addBreadcrumbData(document.url, doc);

doc.pageTitle = getPageTitle(doc);
const pageTitle = getPageTitle(doc);
doc.pageTitle = rewritePageTitleForSEO(doc.mdn_url, pageTitle);

// Decide whether it should be indexed (sitemaps, robots meta tag, search-index)
doc.noIndexing =
Expand Down
Loading

0 comments on commit 616a17d

Please sign in to comment.