Skip to content

Deploy Prod

Deploy Prod #221

Workflow file for this run

name: Deploy Prod
on:
workflow_dispatch:
inputs:
patch:
description: 'Should this be a patch release?'
type: boolean
required: true
default: true
schedule:
# Deploy at 5pm Sunday PST, which is 1am Monday UTC
# * is a special character in YAML so you have to quote this string
- cron: '0 1 * * 1'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2 # So sentry can get the previous commit
# Use the dim-release-bot token rather than the default
token: ${{ secrets.GH_TOKEN }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn
- name: Install SSH key
uses: benoitchantre/[email protected]
with:
private-key: ${{ secrets.SSH_KEY }}
private-key-name: dim.rsa
known-hosts: ${{ secrets.REMOTE_HOST }}
- name: get-npm-version
id: package-version
uses: martinbeentjes/[email protected]
- name: set feature
if: ${{ !github.event.inputs.patch }}
run: |
echo "build_level=feature" >> $GITHUB_ENV
- name: set bug
if: ${{ github.event.inputs.patch }}
run: |
echo "build_level=bug" >> $GITHUB_ENV
- name: Bump release version
id: bump_version
uses: christian-draeger/[email protected]
with:
current-version: ${{ steps.package-version.outputs.current-version }}
version-fragment: ${{ env.build_level }}
- name: set version
run: |
echo "VERSION=${{ steps.bump_version.outputs.next-version }}" >> $GITHUB_ENV
- name: Update Version in package.json
uses: dmikey/package-json-version@master
with:
version: ${{ env.VERSION }}
- name: Install
run: yarn install --frozen-lockfile --prefer-offline
- name: Build and deploy
run: ./build/deploy-prod.sh
env:
NODE_OPTIONS: "--max_old_space_size=8192"
WEB_API_KEY: ${{ secrets.PROD_API_KEY }}
WEB_OAUTH_CLIENT_ID: ${{ secrets.PROD_OAUTH_CLIENT_ID }}
WEB_OAUTH_CLIENT_SECRET: ${{ secrets.PROD_OAUTH_CLIENT_SECRET }}
DIM_API_KEY: ${{ secrets.PROD_DIM_API_KEY }}
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_PATH: app.destinyitemmanager.com
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
# Use the dim-release-bot token rather than the default
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Purge CloudFlare cache
run: ./build/purge-cloudflare.sh
env:
CLOUDFLARE_KEY: ${{ secrets.CLOUDFLARE_KEY }}
CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }}
APP_DOMAIN: app.destinyitemmanager.com
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: destiny-item-manager
SENTRY_PROJECT: dim
with:
environment: release
version: ${{ env.VERSION }}
ignore_missing: true