diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..0a647ee67 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ +name: BuildAndDeploy + +on: [push] + +jobs: + build-and-deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: '10.x' + - run: npm i + - 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: start deployment + uses: bobheadxi/deployments@v0.5.2 + id: deployment + with: + step: start + token: ${{ secrets.GITHUB_TOKEN }} + env: ${{ steps.get_branch.outputs.branch }} + desc: Setting up staging deployment for ${{ steps.get_branch.outputs.branch }} + - name: deploy to gcloud dev branch + uses: actions-hub/gcloud@master + env: + PROJECT_ID: neuromancer-seung-import + APPLICATION_CREDENTIALS: ${{ secrets.SA_NEUROMANCER_GOOGLE_APPS_DEPLOY }} + with: + args: app deploy appengine/frontend/app.yaml --no-promote --version ${{ steps.get_branch.outputs.branch }} + - name: update deployment status + uses: bobheadxi/deployments@v0.5.2 + if: always() + with: + step: finish + token: ${{ secrets.GITHUB_TOKEN }} + env: ${{ steps.deployment.outputs.env }} + env_url: https://${{ steps.get_branch.outputs.branch }}-dot-neuromancer-seung-import.appspot.com + status: ${{ job.status }} + deployment_id: ${{ steps.deployment.outputs.deployment_id }}