-
Notifications
You must be signed in to change notification settings - Fork 188
97 lines (81 loc) · 2.77 KB
/
viewer_build_deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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