Skip to content

generate_public_json #538

generate_public_json

generate_public_json #538

name: generate_public_json
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
generate_json:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
steps:
- name: Checkout this tool
uses: actions/checkout@v4
with:
ref: main
- name: Setup python
run: |
python -m pip install --upgrade pip
pip install -r scripts/requirements.txt
- name: Checkout NAAN registry
uses: actions/checkout@v4
with:
repository: CDLUC3/naan_reg_priv
token: ${{ secrets.NAAN_REG_PRIV_PAT }}
path: naan_reg_priv
- name: Add static web files
run: |
mkdir -p docs
touch docs/.nojekyll
- name: Setup node for page generation
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: ./ui_src/package-lock.json
- name: Install dependencies
working-directory: ./ui_src
run: npm ci
- name: Build
working-directory: ./ui_src
run: npm run build
- name: Get timestamp
id: timestamp
run: echo "TAG_TIMESTAMP=$(date +'%Y%m%d.%H%M%S')" >> $GITHUB_ENV
- name: NAANs to JSON
run: |
python scripts/naan_reg_json.py main-naans-to-json -d docs/naan_records.json naan_reg_priv/main_naans
python scripts/naan_reg_json.py shoulder-registry-to-json -d docs/naan_records.json naan_reg_priv/shoulder_registry
python scripts/naan_reg_json.py ezid-overrides -d docs/naan_records.json
- name: Publish documentation
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
tag_name: ${{ env.TAG_TIMESTAMP }}
tag_message: 'Public NAANs update ${{ env.TAG_TIMESTAMP }}'