Merge pull request #281 from microbiomedata/issue-279-nmdc-schema-11.2.1 #166
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto-deployment of nmdc_submission_schema documentation and DH interface | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build-docs: | |
# TODO: this should probably be split into separate build and deploy jobs to | |
# reduce privileged token exposure | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
with: | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- name: Set up Python 3. | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Install Poetry. | |
uses: snok/[email protected] | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install yq | |
env: | |
YQ_VERSION: v4.30.5 | |
YQ_BINARY: yq_linux_amd64 | |
run: | | |
mkdir -p $HOME/.local/bin | |
wget https://github.com/mikefarah/yq/releases/download/$YQ_VERSION/$YQ_BINARY.tar.gz -O - | tar xz && mv $YQ_BINARY $HOME/.local/bin/yq | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Install Python dependencies. | |
run: poetry install -E docs | |
- name: Install JavaScript dependencies. | |
working-directory: data_harmonizer | |
run: npm install | |
- name: Regenerate schema | |
run: | | |
make \ | |
clean \ | |
schema-clean \ | |
src/nmdc_submission_schema/schema/nmdc_submission_schema.yaml \ | |
ingest-triad \ | |
project/json/nmdc_submission_schema.json | |
- name: Build documentation. | |
run: | | |
poetry run gen-doc -d docs src/nmdc_submission_schema/schema/nmdc_submission_schema.yaml | |
cp src/docs/*md docs/ | |
poetry run mkdocs build -d dist | |
- name: Build DataHarmonizer interface. | |
working-directory: data_harmonizer | |
run: | | |
npm run build -- --outDir ../dist/_playground --base /${{ github.event.repository.name }}/_playground/ | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: dist | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |