Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Deploy

Deploy #51

Workflow file for this run

name: Deploy
on:
workflow_dispatch:
push:
branches:
- main
- develop
# pull_request: {}
jobs:
# typecheck:
# name: Check Types
# runs-on: ubuntu-latest
# steps:
# - name: Cancel previous runs
# uses: styfle/[email protected]
# - name: Checkout repo
# uses: actions/checkout@v3
# - name: Set up Node.js
# uses: actions/setup-node@v3
# with:
# node-version: 20
# - name: Install dependencies
# run: npm ci
# - name: Generate code
# run: npm run codegen
# env:
# MAGICSWAP_API_URL: ${{ secrets.MAGICSWAP_API_URL }}
# - name: Check types
# run: npm run typecheck --if-present
deploy:
name: Deploy
runs-on: ubuntu-latest
# needs: typecheck
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' }}
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
- name: Checkout repo
uses: actions/checkout@v3
- name: Read app name
uses: SebRollen/[email protected]
id: app_name
with:
file: "fly.toml"
field: "app"
- name: Setup deploy
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy staging
if: ${{ github.ref == 'refs/heads/develop' }}
run: flyctl deploy --app ${{ steps.app_name.outputs.value }}-staging --remote-only --build-secret dotenv="${{ secrets.ENV_STAGING }}"
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
- name: Deploy production
if: ${{ github.ref == 'refs/heads/main' }}
run: flyctl deploy --remote-only --build-secret dotenv="${{ secrets.ENV_PROD }}"
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
post_deploy:
name: Post-Deployment Tasks
runs-on: ubuntu-latest
needs: deploy
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Purge Cloudflare Cache
uses: jakejarvis/cloudflare-purge-action@master
env:
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}