Skip to content

Merge branch 'tech/sst-v3' into staging #237

Merge branch 'tech/sst-v3' into staging

Merge branch 'tech/sst-v3' into staging #237

Workflow file for this run

name: πŸš€ Deploy
on:
workflow_dispatch:
push:
branches:
- main
- staging
concurrency:
group: ${{ github.ref }}-deploy
env:
CI: true
permissions:
id-token: write
contents: write
defaults:
run:
shell: bash
jobs:
deploy:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
- uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
list-files: 'shell'
filters: |
erpc:
- 'packages/erpc/erpc.yaml'
- 'packages/erpc/Dockerfile'
ponder:
- 'packages/ponder/**'
dockerRelated:
- 'packages/erpc/erpc.yaml'
- 'packages/erpc/Dockerfile'
- 'packages/ponder/**'
- name: "πŸ”§ Set up environment variables"
run: |
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
echo "PONDER_PROD_IMAGE_TAG=${{ github.sha }}" >> $GITHUB_ENV
echo "PONDER_DEV_IMAGE_TAG=${{ github.sha }}" >> $GITHUB_ENV
else
echo "PONDER_PROD_IMAGE_TAG=latest" >> $GITHUB_ENV
echo "PONDER_DEV_IMAGE_TAG=${{ github.sha }}" >> $GITHUB_ENV
fi
- uses: pnpm/action-setup@v4
with:
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: "πŸ”¨ Install dependencies"
run: pnpm install --frozen-lockfile
- name: "πŸ‘₯ Configure AWS Credentials"
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::262732185023:role/github-action-deploy-role
aws-region: eu-west-1
retry-max-attempts: 5
- name: "πŸ‘₯ Login to Amazon ECR"
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Set up QEMU
if: steps.changes.outputs.dockerRelated == 'true'
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: steps.changes.outputs.dockerRelated == 'true'
uses: docker/setup-buildx-action@v3
- name: "πŸ”¨ Build Ponder dev docker dependencies"
if: steps.changes.outputs.ponder == 'true'
uses: docker/build-push-action@v6
with:
context: ./packages/ponder
platforms: linux/arm64
push: true
tags: |
262732185023.dkr.ecr.eu-west-1.amazonaws.com/indexer-dev:latest
262732185023.dkr.ecr.eu-west-1.amazonaws.com/indexer-dev:${{ github.sha }}
# Github actions cache
cache-from: type=gha
cache-to: type=gha,mode=min
- name: "πŸ”¨ Build Ponder prod docker dependencies"
if: steps.changes.outputs.ponder == 'true' && env.PONDER_PROD_IMAGE_TAG != 'latest'
uses: docker/build-push-action@v6
with:
context: ./packages/ponder
platforms: linux/arm64
push: true
tags: |
262732185023.dkr.ecr.eu-west-1.amazonaws.com/indexer-prod:latest
262732185023.dkr.ecr.eu-west-1.amazonaws.com/indexer-prod:${{ github.sha }}
# Github actions cache
cache-from: type=gha
cache-to: type=gha,mode=min
- name: "πŸ”¨ Build ERPC docker dependencies"
if: steps.changes.outputs.erpc == 'true'
uses: docker/build-push-action@v6
with:
context: ./packages/erpc
platforms: linux/arm64
push: true
tags: |
262732185023.dkr.ecr.eu-west-1.amazonaws.com/erpc:latest
262732185023.dkr.ecr.eu-west-1.amazonaws.com/erpc:${{ github.sha }}
# Github actions cache
cache-from: type=gha
cache-to: type=gha,mode=min
no-cache: true
- name: "πŸš€ SST Deploy"
run: |
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
pnpm run deploy:prod
else
pnpm run deploy:dev
fi
pnpm sst deploy --stage prod
env:
ERPC_IMAGE_TAG: ${{ steps.changes.outputs.erpc == 'true' && github.sha || 'latest' }}
PONDER_DEV_IMAGE_TAG: ${{ steps.changes.outputs.ponder == 'true' && env.PONDER_DEV_IMAGE_TAG || 'latest' }}
PONDER_PROD_IMAGE_TAG: ${{ steps.changes.outputs.ponder == 'true' && env.PONDER_PROD_IMAGE_TAG || 'latest' }}