This repository has been archived by the owner on Nov 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
68 lines (68 loc) · 2.16 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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 }}