Skip to content

Commit

Permalink
added github action to build and deploy to app engine
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisj committed Nov 21, 2019
1 parent 4c903a3 commit eb6ee6f
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/on_push_build_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: BuildAndDeploy

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '10.x'
- run: git submodule init
- run: git submodule update
- run: npm i
- run: cd third_party/neuroglancer/ && npm i && cd ../.
- run: npm run build
- run: cp -r ./dist/dev appengine/frontend/static/
- name: Extract branch name
id: get_branch
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/} | tr / - | tr _ -)"
- run: echo ${{ steps.get_branch.outputs.branch }}
- name: deploy to gcloud master
if: steps.get_branch.outputs.branch == 'master'
uses: actions-hub/[email protected]
env:
PROJECT_ID: seung-lab
APPLICATION_CREDENTIALS: ${{ secrets.SA_GOOGLE_APPS_DEPLOY }}
with:
args: app deploy appengine/frontend/app.yaml --promote --version ${{ steps.get_branch.outputs.branch }}
- name: deploy to gcloud dev branch
if: steps.get_branch.outputs.branch != 'master'
uses: actions-hub/[email protected]
env:
PROJECT_ID: seung-lab
APPLICATION_CREDENTIALS: ${{ secrets.SA_GOOGLE_APPS_DEPLOY }}
with:
args: app deploy appengine/frontend/app.yaml --no-promote --version ${{ steps.get_branch.outputs.branch }}
32 changes: 32 additions & 0 deletions appengine/frontend/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
runtime: python27
api_version: 1
threadsafe: true

# The skip_files element specifies which files
# in the application directory are not to be
# uploaded to App Engine.
skip_files:
- ^(.*/)?#.*#$
- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$
- ^node_modules$

service: ngextend

handlers:
# Handle the main page by serving the index page.
# Note the $ to specify the end of the path, since app.yaml does prefix matching.
- url: /$
static_files: static/index.html
upload: static/index.html
login: optional
secure: always
redirect_http_response_code: 301

- url: /
static_dir: static
login: optional
secure: always
redirect_http_response_code: 301

0 comments on commit eb6ee6f

Please sign in to comment.