commit
a4d679e6b1
@ -1,6 +1,6 @@
|
||||
## Steps to use scripts
|
||||
|
||||
### Single dataset with no portal commit
|
||||
### Deploy single dataset with no portal commit
|
||||
This script creates and commit only the build files from nextjs to the gh-pages branch.
|
||||
|
||||
**Step 1:** Export an env variable with the name of your dataset github repo.
|
||||
@ -45,13 +45,74 @@ source portal.sh
|
||||
```
|
||||
> Note: Use `source` instead of `bash` so that the script can work well with environment variables.
|
||||
|
||||
**Step 3:**
|
||||
**Step 4:**
|
||||
Go to your repository's github `pages` in setting and set the Branch to gh-pages and folder to root:
|
||||
<img src='./assets/sdnocommit.png' />
|
||||
|
||||
**Step 4:**
|
||||
Open your deployed site
|
||||
**Step 5:**
|
||||
Open your deployed site at `https://<your github username>/github.io/<dataset repo name>`
|
||||
|
||||
____
|
||||
|
||||
### Deploy single dataset with portal commit
|
||||
This script creates and commit the portal code as well as add an automated script to deploy page. Follow the steps below to use this script.
|
||||
|
||||
**Step 1:** Create a Github Personal Access Token (PAT).
|
||||
|
||||
**Step 2:** Create a github secret with the name `PORTAL_NEXT_TOKEN`. The value should be the PAT created in step 1.
|
||||
|
||||
> Note: Without the PAT and the secret configured, the automatic build will fail.
|
||||
|
||||
**Step 3:** In your computer's terminal/command prompt, export an environment variable with the name of your dataset's github repo.
|
||||
|
||||
For example if you want to deploy the dataset at https://github.com/datasets/finance-vix, then export the name using the command:
|
||||
```bash
|
||||
export PORTAL_REPO_NAME=finance-vix
|
||||
```
|
||||
|
||||
**Step 4:** Create a file called `portal.sh` and paste the following content:
|
||||
```bash
|
||||
#!/bin/bash
|
||||
rm -rf portal
|
||||
mkdir -p portal
|
||||
npx create-next-app portal -e https://github.com/datopian/portal.js/tree/main/examples/dataset-frictionless
|
||||
mkdir portal/public/dataset
|
||||
|
||||
cp -a ./data portal/public/dataset
|
||||
cp -a ./datapackage.json portal/public/dataset
|
||||
cp -a ./README.md portal/public/dataset
|
||||
|
||||
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
|
||||
|
||||
cd portal
|
||||
assetPrefix='"/'$PORTAL_REPO_NAME'/"'
|
||||
basePath='"/'$PORTAL_REPO_NAME'"'
|
||||
echo 'module.exports = {assetPrefix:' ${assetPrefix}', basePath: '${basePath}' }' > next.config.js ## This ensures css and public folder works
|
||||
|
||||
cd ..
|
||||
git add .
|
||||
git commit -m "Add dataset build feature"
|
||||
git push
|
||||
|
||||
```
|
||||
**Step 5:** Run the bash script with:
|
||||
```bash
|
||||
source portal.sh
|
||||
```
|
||||
> Note: Use `source` instead of `bash` so that the script can work well with environment variables.
|
||||
|
||||
**Step 6:**
|
||||
Go to your repository's github `pages` in setting and set the Branch to gh-pages and folder to root:
|
||||
<img src='./assets/sdnocommit.png' />
|
||||
|
||||
**Step 7:**
|
||||
Open your deployed site at `https://<your github username>/github.io/<dataset repo name>`
|
||||
|
||||
____
|
||||
### Single dataset with portal code commit
|
||||
TODO
|
||||
|
||||
|
||||
26
scripts/single-dataset-commit.sh
Normal file
26
scripts/single-dataset-commit.sh
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
rm -rf portal
|
||||
mkdir -p portal
|
||||
npx create-next-app portal -e https://github.com/datopian/portal.js/tree/main/examples/dataset-frictionless
|
||||
mkdir portal/public/dataset
|
||||
|
||||
cp -a ./data portal/public/dataset
|
||||
cp -a ./datapackage.json portal/public/dataset
|
||||
cp -a ./README.md portal/public/dataset
|
||||
|
||||
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
|
||||
|
||||
cd portal
|
||||
assetPrefix='"/'$PORTAL_REPO_NAME'/"'
|
||||
basePath='"/'$PORTAL_REPO_NAME'"'
|
||||
echo 'module.exports = {assetPrefix:' ${assetPrefix}', basePath: '${basePath}' }' > next.config.js ## This ensures css and public folder works
|
||||
|
||||
cd ..
|
||||
git add .
|
||||
git commit -m "Add dataset build feature"
|
||||
# git push
|
||||
echo "Portal generated, please push your code to github"
|
||||
Loading…
x
Reference in New Issue
Block a user