Deploy - Prod #636
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Deploy - Prod' | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'debug-*' | |
defaults: | |
run: | |
shell: bash | |
env: | |
STAGE: 'prod' | |
ACTIONS_RUNNER_DEBUG: true | |
jobs: | |
deploy: | |
# if workflow_dispatch or branch name starts with debug- and commit message contains [deploy] | |
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && startsWith(github.ref, 'refs/heads/debug-') && contains(github.event.head_commit.message, '[deploy]')) | |
name: deploy | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node-version: [lts/*] | |
pnvm-version: [latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
CLICKHOUSE_HOST: ${{ secrets.CLICKHOUSE_HOST }} | |
CLICKHOUSE_USER: ${{ secrets.CLICKHOUSE_USER }} | |
CLICKHOUSE_PASSWORD: ${{ secrets.CLICKHOUSE_PASSWORD }} | |
LLAMANODES_API_KEY: ${{ secrets.LLAMANODES_API_KEY }} | |
DEFILLAMA_LABELS_API_KEY: ${{ secrets.DEFILLAMA_LABELS_API_KEY }} | |
DEFILLAMA_PRICE_API_KEY: ${{ secrets.DEFILLAMA_PRICE_API_KEY }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
CLOUDFLARE_R2_PUBLIC_URL: ${{ secrets.CLOUDFLARE_R2_PUBLIC_URL }} | |
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} | |
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }} | |
ANKR_API_KEY: ${{ secrets.ANKR_API_KEY }} | |
NFTPORT_API_KEY: ${{ secrets.NFTPORT_API_KEY }} | |
OPENSEA_API_KEY: ${{ secrets.OPENSEA_API_KEY }} | |
NFTSCAN_API_KEY: ${{ secrets.NFTSCAN_API_KEY }} | |
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }} | |
CENTER_API_KEY: ${{ secrets.CENTER_API_KEY }} | |
QUICKNODE_API_KEY: ${{ secrets.QUICKNODE_API_KEY }} | |
QUICKNODE_HTTP_URL: ${{ secrets.QUICKNODE_HTTP_URL }} | |
RESERVOIR_API_KEY: ${{ secrets.RESERVOIR_API_KEY }} | |
BALANCES_DDB: ${{ secrets.BALANCES_DDB }} | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v3 | |
- name: 'Setup pnpm [${{ matrix.pnvm-version }}]' | |
uses: pnpm/action-setup@v2.2.4 | |
with: | |
version: ${{ matrix.pnvm-version }} | |
- name: 'Setup Node.js [${{ matrix.node-version }}]' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: pnpm | |
- name: 'Install Dependencies' | |
run: | | |
pnpm install --frozen-lockfile | |
pnpm add --global serverless serverless-esbuild | |
- name: 'Build' | |
run: pnpm build | |
env: | |
NODE_ENV: 'production' | |
- name: 'Deploy' | |
run: | | |
# | |
# auth | |
# | |
serverless config credentials \ | |
--provider aws \ | |
--key ${{ env.AWS_ACCESS_KEY_ID }} \ | |
--secret ${{ env.AWS_SECRET_ACCESS_KEY }} | |
# | |
# deploy | |
# | |
serverless deploy \ | |
--config serverless.yml \ | |
--stage prod \ | |
--region ${{ env.AWS_REGION }} \ | |
--verbose | |
env: | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }} | |
# enables verbose logging | |
ACTIONS_STEP_DEBUG: true | |
NODE_ENV: 'production' |