diff --git a/scripts/README.md b/site/content/publish.md similarity index 87% rename from scripts/README.md rename to site/content/publish.md index 116bc792..78b82411 100644 --- a/scripts/README.md +++ b/site/content/publish.md @@ -1,7 +1,9 @@ # Publishing data on Github using Portal.js and Github pages - -Use case: you have some data in a Github repo and you'd like to publish it online using "portal" so that it is easy for others to view, explore and use. - +--- +**Use Case:** +--- +You have some data in a Github repo and you'd like to publish it online using "portal" so that it is easy for others to view, explore and use. +--- Here we show how you can use portal.js plus github actions to publish your dataset in minutes and keep it updated as you make changes. The example focuses on the case of a [Frictionless dataset][fd] but it works for any dataset type supported by portal.js. @@ -29,11 +31,11 @@ In the dataset repository you want to publish, create a github secret with the n See steps on creating a secret [here](https://docs.github.com/en/actions/reference/encrypted-secrets) - + ### Step 2 -In the dataset repository you want deploy create a `.github/workflow` directory and add a `main.yml` file with the following content (you can also view/download this [action file here]("./actions/single-dataset-ssg.yml"): +In the dataset repository you want deploy create a `.github/workflow` directory and add a `main.yml` file with the following content (you can also view/download this [action file here](scripts/actions/single-dataset-ssg.yml): ```bash name: github pages @@ -58,7 +60,7 @@ jobs: env: PORTAL_REPO_NAME: ${{ secrets.PORTAL_REPO_NAME }} run: | - curl https://raw.githubusercontent.com/datopian/portal.js/main/scripts/single-dataset-no-commit.sh > portal.sh + curl https://raw.githubusercontent.com/datopian/portal.js/main/site/public/scripts/single-dataset-no-commit.sh > portal.sh git config --local user.email "$(git log --format='%ae' HEAD^!)" git config --local user.name "$(git log --format='%an' HEAD^!)" source ./portal.sh @@ -77,7 +79,7 @@ git push Wait for a while as your page builds, and once you see the green check mark, navigate to your repository's github `pages` in settings, set the `source` to `gh-pages` and folder to `/root`: - + ## Deploy single dataset without commiting portal.js code @@ -107,7 +109,7 @@ export PORTAL_REPO_NAME=finance-vix ### Step 3 -In the dataset repository's root folder, create a file called `portal.sh` and paste the following content: +In the dataset repository's root folder, create a file called `portal.sh` and paste the following [content](/scripts/single-dataset-no-commit.sh): ```bash #!/bin/bash @@ -153,7 +155,7 @@ source portal.sh Go to your repository's github `pages` in setting and set the Branch to gh-pages and folder to root: - + ### Step 6 @@ -164,7 +166,7 @@ Open your deployed site at `https:///github.io/ .github/workflows/main.yml +curl https://raw.githubusercontent.com/datopian/portal.js/main/site/public/scripts/gh-page-builder-action.yml > .github/workflows/main.yml cd portal assetPrefix='"/'$PORTAL_REPO_NAME'/"' @@ -225,6 +227,7 @@ cd .. git add . git commit -m "Add dataset build feature" git push +echo "Portal generated, please push your code to github" ``` ### Step 6 @@ -241,7 +244,7 @@ source portal.sh Go to your repository's github `pages` in setting and set the Branch to gh-pages and folder to root: - + ### Step 8 diff --git a/site/pages/index.js b/site/pages/index.js index eca719ae..891a0687 100644 --- a/site/pages/index.js +++ b/site/pages/index.js @@ -52,9 +52,24 @@ export default function Home() { >

▸ Contribute

- Checkout the Portal.js repository on github + Checkout the Portal.js repository on Github.

+ + +

▸ Publish

+

+ Learn how to publish data stored on Github using Portal.js and Github Pages. +

+
+ {/* Use code below to create an invisible dummy box on the right of Publish box for a good UI look. */} + + diff --git a/scripts/actions/single-dataset-ssg.yml b/site/public/scripts/actions/single-dataset-ssg.yml similarity index 89% rename from scripts/actions/single-dataset-ssg.yml rename to site/public/scripts/actions/single-dataset-ssg.yml index 0ced09ab..83ec12e6 100644 --- a/scripts/actions/single-dataset-ssg.yml +++ b/site/public/scripts/actions/single-dataset-ssg.yml @@ -20,7 +20,7 @@ jobs: env: PORTAL_REPO_NAME: ${{ secrets.PORTAL_REPO_NAME }} run: | - curl https://raw.githubusercontent.com/datopian/portal.js/main/scripts/single-dataset-no-commit.sh > portal.sh + curl https://raw.githubusercontent.com/datopian/portal.js/main/site/public/scripts/single-dataset-no-commit.sh > portal.sh git config --local user.email "$(git log --format='%ae' HEAD^!)" git config --local user.name "$(git log --format='%an' HEAD^!)" source ./portal.sh diff --git a/scripts/assets/sdnocommit.png b/site/public/scripts/assets/sdnocommit.png similarity index 100% rename from scripts/assets/sdnocommit.png rename to site/public/scripts/assets/sdnocommit.png diff --git a/scripts/assets/secrets.png b/site/public/scripts/assets/secrets.png similarity index 100% rename from scripts/assets/secrets.png rename to site/public/scripts/assets/secrets.png diff --git a/scripts/gh-page-builder-action.yml b/site/public/scripts/gh-page-builder-action.yml similarity index 100% rename from scripts/gh-page-builder-action.yml rename to site/public/scripts/gh-page-builder-action.yml diff --git a/scripts/single-dataset-commit.sh b/site/public/scripts/single-dataset-commit.sh similarity index 91% rename from scripts/single-dataset-commit.sh rename to site/public/scripts/single-dataset-commit.sh index 6db5cb70..76e37f5d 100644 --- a/scripts/single-dataset-commit.sh +++ b/site/public/scripts/single-dataset-commit.sh @@ -12,7 +12,7 @@ PORTAL_DATASET_PATH=$PWD"/portal/public/dataset" export PORTAL_DATASET_PATH mkdir -p .github && mkdir -p .github/workflows && touch .github/workflows/main.yml -curl https://raw.githubusercontent.com/datopian/portal.js/main/scripts/gh-page-builder-action.yml > .github/workflows/main.yml +curl https://raw.githubusercontent.com/datopian/portal.js/main/site/public/scripts/gh-page-builder-action.yml > .github/workflows/main.yml cd portal assetPrefix='"/'$PORTAL_REPO_NAME'/"' @@ -22,5 +22,5 @@ echo 'module.exports = {assetPrefix:' ${assetPrefix}', basePath: '${basePath}' } cd .. git add . git commit -m "Add dataset build feature" -# git push +git push echo "Portal generated, please push your code to github" diff --git a/scripts/single-dataset-no-commit.sh b/site/public/scripts/single-dataset-no-commit.sh similarity index 100% rename from scripts/single-dataset-no-commit.sh rename to site/public/scripts/single-dataset-no-commit.sh