Merge pull request #22 from jacobfilik/filterdata #61
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Node.js CI | |
env: | |
DATA_REPO: jacobfilik/bmm-standards | |
DATA_PATH_IN_REPO: Data | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run build | |
run: pnpm run build --base=/webxdiviewer/ | |
- name: Uploading production-ready build files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: production-files | |
path: ./dist | |
data: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout database build script | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
scripts/build_database.py | |
sparse-checkout-cone-mode: false | |
- name: Filtered checkout of data | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
${{ env.DATA_PATH_IN_REPO }} | |
repository: ${{ env.DATA_REPO }} | |
path: tmp_xdidata | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
pip install xraylarch | |
- name: list | |
run: | | |
ls | |
- name: Build db | |
run: | | |
mkdir xdidata | |
mv tmp_xdidata/${{ env.DATA_PATH_IN_REPO }}/* xdidata/ | |
python scripts/build_database.py | |
- name: Uploading data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: data-files | |
path: ./xdidata | |
deploy: | |
name: Deploy | |
needs: [build, data] | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Downloading artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: production-files | |
path: ./dist | |
- name: Downloading data | |
uses: actions/download-artifact@v4 | |
with: | |
name: data-files | |
path: ./dist/xdidata | |
- name: Deploying to gh-pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist |