diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..da40ae3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + - package-ecosystem: 'npm' + directory: '/' + schedule: + interval: 'daily' + open-pull-requests-limit: 0 + target-branch: 'development' diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/deploy.yml similarity index 55% rename from .github/workflows/gh-pages.yml rename to .github/workflows/deploy.yml index 7382d05..5255203 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/deploy.yml @@ -1,21 +1,22 @@ -name: public-build +name: Deploy to GitHub Pages on: push: - branches: [main, setup] + branches: + - main + - setup workflow_dispatch: jobs: build: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: ref: 'main' fetch-depth: 0 - - - uses: actions/checkout@v2 + + - uses: actions/checkout@v4 with: ref: 'setup' fetch-depth: 0 @@ -25,32 +26,44 @@ jobs: run: cp -r _setup/* . - name: Setup Node.js - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: - node-version: '16' + node-version: '20' - name: Cache dependencies - uses: actions/cache@v2 + uses: actions/cache@v4 id: npm-cache with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- + - name: Install dependencies run: npm ci - name: Build public view run: npm run build - - name: Deploy to GitHub Pages - uses: crazy-max/ghaction-github-pages@v2 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 with: - target_branch: gh-pages - build_dir: dist - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + path: ./dist + + deploy: + needs: build + permissions: + pages: write + id-token: write + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 permissions: contents: write - diff --git a/README.md b/README.md index b96da9c..36dc092 100644 --- a/README.md +++ b/README.md @@ -68,9 +68,10 @@ TaxonPages software is in active development and changes are expected that will 1. Click on "Fork" button to create your own repository from this. 2. Uncheck `Copy the setup branch only` and press `Save` -3. After create your repo, go to `Settings > Pages`, on "Branch" select `gh-pages` and `/(root)`. Then press save -4. Open `router.yml` file and change `base_url` to the name of your repository. -5. After a couple of minutes, your public page should be available at `https://.github.io/` +3. After create your repo, go to `Settings > Pages`, on "Build and deployment - Source" select `GitHub Actions`. +4. Go to `Actions` tab and press `I understand my workflows, go ahead and enable them` button +5. Open `router.yml` file and change `base_url` to the name of your repository. +6. After a couple of minutes, your public page should be available at `https://.github.io/` ### Setup @@ -251,6 +252,22 @@ taxa_page: # - - - panel:specimen-records ``` +### Lifecycle hooks (Experimental feature) + +The `onCreatePage` and `onSSRPageCreate` functions allow you to execute code at the time the taxa page is created. `onSSRPageCreate` will be executed only on the server side in SSR mode. To make use of them it is necessary to include them in a file object called `pages/otus.config.js`. Both functions accept `otu`, `taxon`, `route` and `router` objects as parameters. Since `onCreatePage` runs on Taxa page component, it is possible to use hooks like `onMounted` or `onBeforeMount` inside it + +```javascript +export default { + onSSRCreatePage: async ({ otu, taxon, route, router }) => { + // Your code here + }, + + onCreatePage: ({ otu, taxon, route, router }) => { + // Your code here + } +} +``` + ### External panels To add panels in Taxa pages, create a folder called `panels` in your `setup` branch, and inside it create another folder for your panel. For example: `panels/PanelTest` diff --git a/config/taxa_page.yml.example b/config/taxa_page.yml.example index 2000e13..68c816c 100644 --- a/config/taxa_page.yml.example +++ b/config/taxa_page.yml.example @@ -10,4 +10,5 @@ taxa_page: - - panel:map - panel:descendants - panel:content + - panel:keys - panel:statistics