Skip to content

Deploy to Dev Server #105

Deploy to Dev Server

Deploy to Dev Server #105

name: Deploy to Dev Server
on:
workflow_run:
workflows: [CI]
branches: [main]
types:
- completed
env:
BANCHAN_DEPLOY_ENV: staging
BANCHAN_HOST: dev.banchan.art
OBAN_KEY_FINGERPRINT: ${{ secrets.OBAN_KEY_FINGERPRINT }}
OBAN_LICENSE_KEY: ${{ secrets.OBAN_LICENSE_KEY }}
jobs:
deploy:
name: Deploy Banchan to Staging Server
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
environment:
name: Staging
url: https://dev.banchan.art
strategy:
matrix:
elixir: [1.14.5]
otp: [25]
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Setup BEAM
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v2
id: mix-cache
with:
path: |
deps
_build
priv/plts
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
- name: Install Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mkdir -p priv/plts
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile
mix dialyzer --plt
- run: mix deploy.dev --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_DEV_DEPLOY_API_TOKEN }}