Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Pr vitepress version test origin - deploy workflow #3066

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a33a4c5
Add vitepress folder - with basic config. No algolia
hamishwillee Dec 13, 2023
7b31888
.gitigore: Add vitepress dist/etc. Adjust if move
hamishwillee Dec 13, 2023
564d168
package.json: Add vitepress build stuff
hamishwillee Dec 13, 2023
f2309df
Add placeholder index in root
hamishwillee Dec 13, 2023
8ec544e
public: copy into root
hamishwillee Dec 13, 2023
972a695
Move the public files out of en tree - they are now not localised
hamishwillee Dec 13, 2023
3f7c522
Remove spurious sidebar debug
hamishwillee Dec 13, 2023
9fa7579
Update uorb.graph and safety so they import from public
hamishwillee Dec 13, 2023
3686706
Exclude tr from build
hamishwillee Dec 13, 2023
e848c22
Delete LANGS.md - not used anymore
hamishwillee Dec 14, 2023
cb485c3
Add build options with bigger Javascript memory
hamishwillee Dec 14, 2023
86c7ff1
Redirect based on site title for contrib pages - ENG
hamishwillee Dec 14, 2023
365d35d
Redirect based on site title for contrib pages - TRANSLATIONS - REVER…
hamishwillee Dec 14, 2023
5c8b8a5
Ignore dead links - needs to be renabled at very end
hamishwillee Dec 14, 2023
8d53d65
.gitignore: add .vitepress/.temp/
hamishwillee Dec 14, 2023
a750939
Algolia enabled if deployed
hamishwillee Dec 14, 2023
443c368
Add redirect component
hamishwillee Feb 21, 2024
3121c3a
Vitepress - exclude UK build by default
hamishwillee Feb 21, 2024
4927244
Add build fail logging of current page
hamishwillee Feb 21, 2024
75c2330
Add deploy github workflow test
hamishwillee Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Sample workflow for building and deploying a VitePress site to GitHub Pages
#
name: Deploy VitePress site to Pages

on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches: [main]
pull_request:
branches:
- '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
#with:
#fetch-depth: 0 # Not needed if lastUpdated is not enabled

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm # or pnpm / yarn
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install dependencies
#run: npm ci # or pnpm install / yarn install / bun install
run: yarn install
- name: Build with VitePress
run: |
yarn docs:build_ubuntu
touch .vitepress/dist/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: .vitepress/dist

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@ logs

#Sublime Projects
*.sublime-project
*.sublime-workspace
*.sublime-workspace


# vitepress - user guide
node_modules/
#docs/.vitepress/cache/
#docs/.vitepress/dist/
.vitepress/cache/
.vitepress/dist/
.vitepress/.temp/

151 changes: 151 additions & 0 deletions .vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import { defineConfig } from "vitepress";
const getSidebar = require("./get_sidebar.js");
//import { getSidebar } from "./get_sidebar";

import markdownItVideo from "markdown-it-video";

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "PX4 Guide (main)",
description: "PX4 User and Developer Guide",
base: process.env.BRANCH_NAME
? "/" + process.env.BRANCH_NAME + "/"
: "/px4_user_guide/",
srcExclude: [
"de/**/*.md",
"ja/**/*.md",
"ru/**/*.md",
"tr/**/*.md",
"uk/**/*.md",
],
ignoreDeadLinks: true,
markdown: {
math: true,

// container: {
// tipLabel: "Note",
// },

config: (md) => {
// use more markdown-it plugins!
md.use(markdownItVideo);
},
},
locales: {
en: {
label: "English",
// other locale specific properties...
themeConfig: {
sidebar: getSidebar.sidebar("en"),
},
},
zh: {
label: "中文 (Chinese)",
lang: "zh-CN", // optional, will be added as `lang` attribute on `html` tag
themeConfig: {
sidebar: getSidebar.sidebar("zh"),
},
// other locale specific properties...
},
ko: {
label: "한국어 (Korean)",
lang: "ko-KR", // optional, will be added as `lang` attribute on `html` tag
themeConfig: {
sidebar: getSidebar.sidebar("ko"),
},

// other locale specific properties...
},
},
//Logs every page loaded on build. Good way to catch errors not caught by other things.
async transformPageData(pageData, { siteConfig }) {
console.log(pageData.filePath);
},
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
logo: "/px4-logo.svg",
sidebar: getSidebar.sidebar("en"),
editLink: {
pattern: "https://github.com/PX4/PX4-user_guide/edit/main/:path",
text: "Edit on GitHub",
},

search: {
provider: process.env.BRANCH_NAME ? "algolia" : "local",
//provider: "local",
//provider: "algolia",
options: {
appId: "HHWW7I44JO",
apiKey: "48919e1dffc6e0ce4c0d6331343d2c0e",
indexName: "px4",
searchParameters: {
facetFilters: [`version:${process.env.BRANCH_NAME}`],
},
},
},

nav: [
{
text: "PX4",
items: [
{
text: "Website",
link: "https://px4.io/",
ariaLabel: "PX4 website link",
},
{
text: "Autopilot Source Code",
link: "https://github.com/PX4/PX4-Autopilot",
},
{
text: "Docs Source Code",
link: "https://github.com/PX4/PX4-user_guide",
},
],
},
{
text: "Dronecode",
items: [
{
text: "QGroundControl",
link: "http://qgroundcontrol.com/",
},
{
text: "MAVSDK",
link: "https://mavsdk.mavlink.io/",
},
{
text: "MAVLINK",
link: "https://mavlink.io/en/",
},
{
text: "QGroundControl Guide",
link: "https://docs.qgroundcontrol.com/master/en/qgc-user-guide/",
},
{
text: "Dronecode Camera Manager",
link: "https://camera-manager.dronecode.org/en/",
},
],
},
{
text: "Support",
link: "https://docs.px4.io/main/en/contribute/support.html",
},
{
text: "Version",
items: [
{ text: "main", link: "https://docs.px4.io/main/zh/" },
{ text: "v1.14", link: "https://docs.px4.io/v1.14/zh/" },
{ text: "v1.13", link: "https://docs.px4.io/v1.13/zh/" },
{ text: "v1.12", link: "https://docs.px4.io/v1.12/zh/" },
{ text: "v1.11", link: "https://docs.px4.io/v1.11/zh/" },
],
},
],

socialLinks: [
{ icon: "github", link: "https://github.com/PX4/PX4-user_guide" },
],
},
});
Loading
Loading