Correct documentation redirects (and fix the workflow) (#1621)

* checkout before artifact

* config for fork

* pass pull request number (again)

* worthless change to trigger build

* use comment url path

* let's play around with redirects

* trigger change

* redirects

* update config

* remove firebase.json from pull request

* remove redirects

* use an index page instead of redirects

* intro -> index

* revert unnecessary changes

* correct format
This commit is contained in:
Simon 2020-10-15 22:11:30 +02:00 committed by GitHub
parent 2bbb35027f
commit cbf6a13ac2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 80 additions and 55 deletions

View File

@ -3,17 +3,21 @@ on:
pull_request:
branches: [master]
paths:
- "docs/**/*"
- "website/**/*"
- "docs/**"
- "website/**"
# firebase.json has no effect here
push:
branches: [master]
paths:
- "docs/**/*"
- "website/**/*"
- "docs/**"
- "website/**"
- "firebase.json"
jobs:
build:
runs-on: ubuntu-latest
env:
PR_INFO_FILE: ".PR_INFO"
steps:
- uses: actions/checkout@v2
- name: Setup node
@ -33,3 +37,16 @@ jobs:
name: website
path: website/build/yew
retention-days: 1
- if: github.event_name == 'pull_request'
name: Build pr info
run: |
echo "${{ github.event.number }}" > $PR_INFO_FILE
- if: github.event_name == 'pull_request'
name: Upload pr info
uses: actions/upload-artifact@v2
with:
name: pr-info
path: "${{ env.PR_INFO_FILE }}"
retention-days: 1

View File

@ -8,6 +8,8 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
env:
PR_INFO_FILE: ".PR_INFO"
steps:
- if: github.event.workflow_run.conclusion != 'success'
name: Abort if build failed
@ -15,6 +17,9 @@ jobs:
echo "build failed"
exit 1
# need to checkout to get "firebase.json", ".firebaserc"
- uses: actions/checkout@v2
- name: Download build artifact
uses: dawidd6/action-download-artifact@v2
with:
@ -24,10 +29,24 @@ jobs:
name: website
path: website/build/yew
- if: github.event.workflow_run.event == 'pull_request'
name: Download pr info
uses: dawidd6/action-download-artifact@v2
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
workflow: build-website.yml
run_id: ${{ github.event.workflow_run.id }}
name: pr-info
- if: github.event.workflow_run.event == 'pull_request'
name: Apply pull request environment
run: |
echo "PR_NUMBER=${{ github.event.workflow_run.pull_requests[0].number }}" >> $GITHUB_ENV
pr_number=$(cat "$PR_INFO_FILE")
if ! [[ "$pr_number" =~ ^[0-9]+$ ]]; then
echo "pr number invalid"
exit 1
fi
echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV
echo "PR_BRANCH=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_ENV
echo "COMMIT_SHA=${{ github.event.workflow_run.head_sha }}" >> $GITHUB_ENV
@ -36,9 +55,6 @@ jobs:
run: |
echo "CHANNEL_ID=live" >> $GITHUB_ENV
# need to checkout to get "firebase.json", ".firebaserc"
- uses: actions/checkout@v2
- name: Deploy to Firebase
uses: siku2/action-hosting-deploy@v1
with:
@ -46,6 +62,9 @@ jobs:
firebaseToken: "${{ secrets.FIREBASE_TOKEN }}"
targets: website
channelId: "${{ env.CHANNEL_ID }}"
# link to the next version because that's what we care about
commentURLPath: "/docs/next/"
# PR information
prNumber: "${{ env.PR_NUMBER }}"
prBranchName: "${{ env.PR_BRANCH }}"
commitSHA: "${{ env.COMMIT_SHA }}"

View File

@ -16,9 +16,9 @@
</p>
<h4>
<a href="https://yew.rs/docs">Documentation (stable)</a>
<a href="https://yew.rs/docs/">Documentation (stable)</a>
<span> | </span>
<a href="https://yew.rs/docs/en/next/intro/">Documentation (latest)</a>
<a href="https://yew.rs/docs/next/">Documentation (latest)</a>
<span> | </span>
<a href="https://github.com/yewstack/yew/tree/v0.17/examples">Examples</a>
<span> | </span>
@ -26,11 +26,11 @@
<span> | </span>
<a href="https://yew.rs/docs/more/roadmap">Roadmap</a>
<span> | </span>
<a href="https://yew.rs/docs/zh-CN">简体中文文档</a>
<a href="https://yew.rs/docs/zh-CN/">简体中文文档</a>
<span> | </span>
<a href="https://yew.rs/docs/zh-TW">繁體中文文檔</a>
<a href="https://yew.rs/docs/zh-TW/">繁體中文文檔</a>
<span> | </span>
<a href="https://yew.rs/docs/ja">ドキュメント</a>
<a href="https://yew.rs/docs/ja/">ドキュメント</a>
</h4>
</div>

View File

@ -3,30 +3,28 @@
{
"target": "website",
"public": "website/build/yew",
"cleanUrls": true,
"redirects": [
// `/intro` -> `/` (2020-10-15)
{
"source": "/",
"destination": "/docs/en/intro/",
"source": "/docs/:lang/intro",
"destination": "/docs/:lang/",
"type": 301
},
{
"source": "/docs",
"destination": "/docs/en/intro/",
"type": 301
},
{
"regex": "/(docs/)?(?P<lang>en|ja|zh-TW|zh-CN)",
"destination": "/docs/:lang/intro/",
"source": "/docs/:lang/next/intro",
"destination": "/docs/:lang/next/",
"type": 301
},
// legacy (2020-08-15)
{
"source": "/docs/v/zh_cn",
"destination": "/docs/zh-CN/intro/",
"destination": "/docs/zh-CN/",
"type": 301
},
{
"source": "/docs/v/zh_tw",
"destination": "/docs/zh-TW/intro/",
"destination": "/docs/zh-TW/",
"type": 301
},
{
@ -39,12 +37,6 @@
"destination": "/docs/zh-TW/:1",
"type": 301
}
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
{

View File

@ -81,7 +81,7 @@
"getting-started/starter-templates": {
"title": "Starter templates"
},
"intro": {
"index": {
"title": "Introduction"
},
"more/css": {
@ -178,7 +178,7 @@
"version-0.17.3/getting-started/version-0.17.3-starter-templates": {
"title": "Starter templates"
},
"version-0.17.3/version-0.17.3-intro": {
"version-0.17.3/version-0.17.3-index": {
"title": "Introduction"
},
"version-0.17.3/more/version-0.17.3-css": {

View File

@ -77,7 +77,7 @@
"getting-started/starter-templates": {
"title": "Starter templates"
},
"intro": {
"index": {
"title": "Introduction"
},
"more/css": {
@ -174,7 +174,7 @@
"version-0.17.3-getting-started/starter-templates": {
"title": "Starter templates"
},
"version-0.17.3-intro": {
"version-0.17.3-index": {
"title": "Introduction"
},
"version-0.17.3-more/css": {

View File

@ -77,7 +77,7 @@
"getting-started/starter-templates": {
"title": "新手模板"
},
"intro": {
"index": {
"title": "简介"
},
"more/css": {
@ -174,7 +174,7 @@
"version-0.17.3-getting-started/starter-templates": {
"title": "Starter templates"
},
"version-0.17.3-intro": {
"version-0.17.3-index": {
"title": "Introduction"
},
"version-0.17.3-more/css": {

View File

@ -77,7 +77,7 @@
"getting-started/starter-templates": {
"title": "Starter templates"
},
"intro": {
"index": {
"title": "Introduction"
},
"more/css": {
@ -174,7 +174,7 @@
"version-0.17.3-getting-started/starter-templates": {
"title": "Starter templates"
},
"version-0.17.3-intro": {
"version-0.17.3-index": {
"title": "Introduction"
},
"version-0.17.3-more/css": {

View File

@ -37,7 +37,7 @@ function Versions(props) {
<a
href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
props.language ? props.language + '/' : ''
}intro`}>
}`}>
Documentation
</a>
</td>
@ -58,7 +58,7 @@ function Versions(props) {
<a
href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
props.language ? props.language + '/' : ''
}next/intro`}>
}next/`}>
Documentation
</a>
</td>
@ -83,7 +83,7 @@ function Versions(props) {
<a
href={`${siteConfig.baseUrl}${siteConfig.docsUrl}/${
props.language ? props.language + '/' : ''
}${version}/intro`}>
}${version}`}>
Documentation
</a>
</td>

View File

@ -1,7 +1,7 @@
{
"docs": {
"Getting Started": [
"intro",
"index",
{
"type": "subcategory",
"label": "Project setup",

View File

@ -2,17 +2,14 @@
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<meta
http-equiv="refresh"
content="0; url=/docs/en/intro"
/>
<meta http-equiv="refresh" content="0; url=/docs/en/" />
<script type="text/javascript">
window.location.href = '/docs/en/intro';
window.location.href = "/docs/en/";
</script>
<title>Yew Docs</title>
</head>
<body>
If you are not redirected automatically, follow this
<a href="/docs/en/intro">link</a>.
<a href="/docs/en/">link</a>.
</body>
</html>
</html>

View File

@ -1,12 +1,12 @@
# Table of contents
* [はじめに](intro.md)
* [はじめに](index.md)
## 始める
* [プロジェクトの準備](getting-started/project-setup.md)
* [trunkを使う](getting-started/project-setup/using-trunk.md)
* [wasm-packを使う](getting-started/project-setup/using-wasm-pack.md)
* [wasm-bindgenを使う](getting-started/project-setup/using-wasm-bindgen.md)
* [cargo-webを使う](getting-started/project-setup/using-cargo-web.md)
* [入門用テンプレート](getting-started/starter-templates.md)
* [サンプルアプリを作る](getting-started/build-a-sample-app.md)

View File

@ -1,6 +1,6 @@
# Table of contents
* [はじめに](intro.md)
* [はじめに](index.md)
## 始める

View File

@ -1,7 +1,7 @@
---
title: Introduction
id: version-0.17.3-intro
original_id: intro
id: version-0.17.3-index
original_id: index
---
## What is Yew?

View File

@ -1,7 +1,7 @@
{
"version-0.17.3-docs": {
"Getting Started": [
"version-0.17.3-intro",
"version-0.17.3-index",
{
"type": "subcategory",
"label": "Project setup",