From 2105baeee010581a241887c4bc17a50cb893c3bb Mon Sep 17 00:00:00 2001 From: Janos <86970079+janosdebugs@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:32:58 +0100 Subject: [PATCH] Move main repo to a submodule to enable live editing (#214) Signed-off-by: Janos Bonic <86970079+janosdebugs@users.noreply.github.com> --- .github/workflows/deploy-dev.yml | 4 ++-- .github/workflows/deploy-prod.yml | 4 ++-- .gitignore | 5 +---- .gitmodules | 4 ++++ Makefile | 26 -------------------------- README.md | 3 ++- docusaurus.config.js | 3 ++- opentofu-repo | 1 + 8 files changed, 14 insertions(+), 36 deletions(-) create mode 100644 .gitmodules delete mode 100644 Makefile create mode 160000 opentofu-repo diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 4ac137f2..43a2766a 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -16,6 +16,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + submodules: 'true' - name: Setup Node uses: actions/setup-node@v3 with: @@ -24,8 +26,6 @@ jobs: run: npm ci - name: Lint code run: npm run lint - - name: Fetch docs - run: make - name: Build website run: npm run build - name: Publish to Cloudflare Pages diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 38c6ec9c..ac2f14af 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -25,6 +25,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + submodules: 'true' - name: Setup Node uses: actions/setup-node@v3 with: @@ -33,8 +35,6 @@ jobs: run: npm ci - name: Lint code run: npm run lint - - name: Fetch docs - run: make - name: Build website run: npm run build - name: Setup Pages diff --git a/.gitignore b/.gitignore index c09fad56..e5f1f23a 100644 --- a/.gitignore +++ b/.gitignore @@ -15,11 +15,8 @@ .env.test.local .env.production.local .eslintcache +.idea npm-debug.log* yarn-debug.log* yarn-error.log* - -/opentofu-repo -/docs/** -!/docs/index.mdx diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..9b37bc56 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "opentofu-repo"] + path = opentofu-repo + url = https://github.com/opentofu/opentofu + branch = main \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 46e32500..00000000 --- a/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# Variables -REPO_URL := https://github.com/opentofu/opentofu.git -CLONE_DIR := ./opentofu-repo -DEST_DIR := . -SOURCE_DIR := website -BRANCH := main - -# Default target to execute when 'make' is called without arguments -all: clean clone copy - -clean : - rm -rf $(CLONE_DIR) - -# Clone the repo -clone: clean - git clone --depth 1 -b $(BRANCH) $(REPO_URL) $(CLONE_DIR); \ - -# Ensure the destination directory exists -prepare-dest: - mkdir -p $(DEST_DIR)/docs - -# Copy the entire folder -copy: clone prepare-dest - cp -v -r $(CLONE_DIR)/$(SOURCE_DIR)/docs/. $(DEST_DIR)/docs/ - -.PHONY: all clone copy prepare-dest diff --git a/README.md b/README.md index dba235d0..4bd75c55 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,8 @@ npm i 3. Fetch the documentation ```bash -make +git submodule init +git submodule update ``` 4. Start the development server diff --git a/docusaurus.config.js b/docusaurus.config.js index 95dfacd3..bc2949af 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -100,12 +100,13 @@ const config = { }, docs: { sidebarPath: require.resolve("./sidebars.js"), + path: "opentofu-repo/website/docs", routeBasePath: "/docs", editUrl: ({ docPath }) => { // Remove the edit link from the documentation index page // TODO: remove after moving the page to the main OpenTofu repo if (docPath === "index.mdx") { - return undefined; + return `https://github.com/opentofu/opentofu.org/edit/main/docs/${docPath}`; } return `https://github.com/opentofu/opentofu/edit/main/website/docs/${docPath}`; diff --git a/opentofu-repo b/opentofu-repo new file mode 160000 index 00000000..5d4ae4f8 --- /dev/null +++ b/opentofu-repo @@ -0,0 +1 @@ +Subproject commit 5d4ae4f8c96f9288a2fc2474dbb67cbd3bb12478