name: Viewer Build and Deploy. on: push: branches: [main] pull_request: branches: [main] jobs: build: name: Build runs-on: ubuntu-latest defaults: run: working-directory: ./nerfstudio/viewer/app steps: - name: Checkout code uses: actions/checkout@master - name: Install Node.js uses: actions/setup-node@v3 with: node-version: 17.8.0 cache: 'yarn' cache-dependency-path: ./nerfstudio/viewer/app/yarn.lock - name: Install packages run: yarn install - name: Build project run: CI=false yarn build - name: Upload production-ready build files uses: actions/upload-artifact@v2 with: name: production-files path: ./nerfstudio/viewer/app/build deploy: name: Deploy needs: build runs-on: ubuntu-latest env: SSH_KEY: ${{secrets.SSH_KEY}} steps: - uses: actions/checkout@v3 - name: Set up Python 3.8.12 uses: actions/setup-python@v4 with: python-version: '3.8.12' - name: Install dependencies run: | pip install -r ./nerfstudio/viewer/app/requirements.txt - name: Download artifact uses: actions/download-artifact@v2 with: name: production-files path: ./nerfstudio/viewer/app/build - name: Get branch name (merge) if: github.event_name != 'pull_request' shell: bash run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV - name: Get branch name (pull request) if: github.event_name == 'pull_request' shell: bash run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV # TODO: detect file or scheme changes of the viewer and only # increment the version.txt file when there is a change. # Update the version.txt code and push to master when things change. # https://github.com/marketplace/actions/changed-files # - name: Run changed-files with defaults on the dir1 # id: changed-files-for-dir1 # uses: tj-actions/changed-files@v29.0.3 # with: # path: nerfstudio/viewer/app # - name: List all added files in dir1 # run: | # for file in ${{ steps.changed-files-for-dir1.outputs.modified_files }}; do # echo "$file was modified" # done - run: | python ./nerfstudio/viewer/app/run_deploy.py \ --branch-name ${{ env.BRANCH_NAME }} \ --ssh-key-string "$SSH_KEY" \ --local-folder ./nerfstudio/viewer/app/build \ --package-json-filename ./nerfstudio/viewer/app/package.json \ --increment-version "False" - run: cat ~/.ssh/config