Skip to content

Commit

Permalink
Merge branch 'sfg-setup' into dev-setup-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
wbbaker committed Nov 14, 2024
2 parents 27a9215 + 0bf4eb5 commit 3670e90
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 19 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'daily'
open-pull-requests-limit: 0
target-branch: 'development'
45 changes: 29 additions & 16 deletions .github/workflows/gh-pages.yml → .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://<your_user_name>.github.io/<your_repo_name>`
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://<your_user_name>.github.io/<your_repo_name>`

### Setup

Expand Down Expand Up @@ -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`
Expand Down
1 change: 1 addition & 0 deletions config/taxa_page.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ taxa_page:
- - panel:map
- panel:descendants
- panel:content
- panel:keys
- panel:statistics

0 comments on commit 3670e90

Please sign in to comment.