File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -318,6 +318,10 @@ function generatePrerelease(prereleaseId) {
318318 */
319319function publishRelease ( ) {
320320 ReleaseOps . publishRelease ( ) ;
321+
322+ // push to latest branch to trigger docs deploy
323+ exec ( "git push origin HEAD:latest -f" ) ;
324+
321325 publishSite ( ) ;
322326}
323327
Original file line number Diff line number Diff line change @@ -16,13 +16,29 @@ const {
1616module . exports = function ( eleventyConfig ) {
1717
1818 /*
19- * The site is loaded from /docs on eslint.org and so we need to adjust
20- * the path prefix so URLs are evaluated correctly.
19+ * The docs stored in the eslint repo are loaded through eslint.org at
20+ * at /docs/head to show the most recent version of the documentation
21+ * based on the HEAD commit. This gives users a preview of what's coming
22+ * in the next release. This is the way that the site works locally so
23+ * it's easier to see if URLs are broken.
24+ *
25+ * When a release is published, HEAD is pushed to the "latest" branch.
26+ * Netlify deploys that branch as well, and in that case, we want the
27+ * docs to be loaded from /docs/latest on eslint.org.
2128 *
2229 * The path prefix is turned off for deploy previews so we can properly
2330 * see changes before deployed.
2431 */
25- const pathPrefix = process . env . CONTEXT === "deploy-preview" ? "" : "/docs" ;
32+
33+ let pathPrefix = "/docs/head" ;
34+
35+ if ( process . env . CONTEXT === "deploy-preview" ) {
36+ pathPrefix = "" ;
37+ } else if ( process . env . BRANCH === "latest" ) {
38+ pathPrefix = "/docs/latest" ;
39+ }
40+
41+ eleventyConfig . addGlobalData ( "GIT_BRANCH" , process . env . BRANCH ) ;
2642
2743 //------------------------------------------------------------------------------
2844 // Filters
Original file line number Diff line number Diff line change 1212 < span class ="label__text "> Version</ span >
1313 </ label >
1414 < select name ="version selector " id ="nav-version-select " aria-describedby ="nav-version-infobox " class ="c-custom-select switcher__select auto-switcher ">
15- < option value ="{{ eslintVersion }} " selected > v{{ eslintVersion }}</ option >
15+ < option value ="HEAD " data-url ="/docs/head/ " {% if GIT_BRANCH ! ="latest " %}selected{% endif %} > HEAD</ option >
16+ < option value ="{{ eslintVersion }} " data-url ="/docs/latest/ " {% if GIT_BRANCH =="latest " %}selected{% endif %} > v{{ eslintVersion }}</ option >
1617 {% for version in versions.items %}
1718 < option value ="{{ version.number }} "
1819 data-url ="{{ version.url }} ">
Original file line number Diff line number Diff line change 1212 < span class ="label__text "> Version</ span >
1313 </ label >
1414 < select name ="version selector " id ="version-select " aria-describedby ="version-infobox " class ="c-custom-select switcher__select auto-switcher ">
15- < option value ="{{ eslintVersion }} " selected > v{{ eslintVersion }}</ option >
15+ < option value ="HEAD " data-url ="/docs/head/ " {% if GIT_BRANCH ! = "latest " %}selected{% endif %} > HEAD</ option >
16+ < option value ="{{ eslintVersion }} " data-url ="/docs/latest/ " {% if GIT_BRANCH == "latest " %}selected{% endif %} > v{{ eslintVersion }}</ option >
1617 {% for version in versions.items %}
1718 < option value ="{{ version.number }} "
1819 data-url ="{{ version.url }} ">
Original file line number Diff line number Diff line change 11< ul class ="versions-list ">
2+ < li > < a href ="/docs/head/ " {% if GIT_BRANCH ! = "latest " %} data-current ="true " {% endif %} > HEAD</ a > </ li >
3+ < li > < a href ="/docs/latest/ " {% if GIT_BRANCH == "latest " %} data-current ="true " {% endif %} > v{{ eslintVersion }}</ a > </ li >
24 {%- for version in versions.items -%}
3- < li > < a href ="{{ version.url }} " {% if config.version == version.number %} data-current =" true " {% endif %} > v{{ version.number }}</ a > </ li >
5+ < li > < a href ="{{ version.url }} "> v{{ version.number }}</ a > </ li >
46 {%- endfor -%}
57</ ul >
You can’t perform that action at this time.
0 commit comments