forked from pancakeswap/pancake-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (61 loc) · 1.86 KB
/
deploy-apis.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 CF API
on:
workflow_dispatch:
inputs:
api:
description: 'API'
required: true
type: choice
options:
- routing
- farms
environment:
description: 'Choose an environment to deploy to: <dev|production>'
required: true
type: choice
default: 'dev'
options:
- dev
- production
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
env:
HAVE_CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN != '' }}
IS_DEV: ${{ github.event.inputs.environment == 'dev' }}
name: Publish API
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up pnpm
uses: pnpm/action-setup@v4
- name: Set up node@18
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: 18.18.2
- name: Install dependencies
run: pnpm i --ignore-scripts
- name: Build package
run: pnpm build:packages
- name: Publish
uses: cloudflare/[email protected]
if: ${{ (env.HAVE_CLOUDFLARE_TOKEN == 'true') && (env.IS_DEV == 'false') }}
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
workingDirectory: 'apis/${{ github.event.inputs.api }}'
command: publish --env ${{ github.event.inputs.environment }}
- name: Publish dev
uses: cloudflare/[email protected]
if: ${{ (env.HAVE_CLOUDFLARE_TOKEN == 'true') && (env.IS_DEV == 'true') }}
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
workingDirectory: 'apis/${{ github.event.inputs.api }}'
command: publish