Skip to content

Merge pull request #931 from sandboxnu/df/update-readme-finalize-hand… #551

Merge pull request #931 from sandboxnu/df/update-readme-finalize-hand…

Merge pull request #931 from sandboxnu/df/update-readme-finalize-hand… #551

Workflow file for this run

name: Deploy Staging
on:
push:
branches:
- master
jobs:
build:
name: Build Dist Branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: "dist"
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: "14"
- name: "set git bot commiter"
run: git config --global user.name "KOH Build Bot" && git config --global user.email "[email protected]"
- name: "merge new changes into dist"
run: git merge origin/master
- run: echo "::set-output name=version::$(git rev-parse origin/master)"
id: pre-version
- uses: bahmutov/npm-install@v1
- run: yarn build
env:
NEXT_PUBLIC_SERVICE_VERSION: ${{ steps.pre-version.outputs.version }}
SERVICE_VERSION: ${{ steps.pre-version.outputs.version }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
## Ensure no new changes have been pushed in the time we spent building
- run: git fetch && echo "::set-output name=version::$(git rev-parse origin/master)"
id: post-version
## Associate release with git commits, so Sentry can guess which commits caused errors
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: sandboxnu
with:
version: ${{ steps.pre-version.outputs.version }}
environment: production
projects: khoury-office-hours khoury-office-hours-frontend
- name: Create Sentry release (staging)
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: sandboxnu
with:
version: ${{ steps.pre-version.outputs.version }}
environment: staging
projects: khoury-office-hours khoury-office-hours-frontend
- if: steps.pre-version.outputs.version == steps.post-version.outputs.version
uses: EndBug/add-and-commit@v4
with:
add: "packages"
author_name: KOH Build Bot
author_email: [email protected]
message: "Added built files"
ref: "dist"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
name: id_rsa
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- uses: actions/checkout@v2
- name: "pm2 deploy to staging"
run: "npx pm2 deploy infrastructure/prod/ecosystem.config.js staging update"