Skip to content

✨ Retail in dashboard #646

✨ Retail in dashboard

✨ Retail in dashboard #646

Workflow file for this run

name: 🚀 Deploy
on:
workflow_dispatch:
inputs:
force_deploy:
description: 'Force the deployment (even if no file changes)'
required: true
type: boolean
default: false
push:
branches:
- main
- dev
concurrency: ${{ github.workflow }}-${{ github.ref }}
env:
CI: true
permissions:
id-token: write
contents: write
defaults:
run:
shell: bash
jobs:
deploy:
name: Deployment
runs-on: 'ubuntu-latest'
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- uses: dorny/paths-filter@v3
name: Check changes
id: changes
with:
base: ${{ github.ref }}
list-files: 'shell'
filters: |
deployRequired:
- 'packages/**'
- 'example/**'
backend:
- 'packages/backend-elysia/**'
- name: Set up QEMU
if: steps.changes.outputs.backend == 'true' || github.event.inputs.force_deploy == 'true'
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64
- name: Set up Docker Buildx
if: steps.changes.outputs.backend == 'true' || github.event.inputs.force_deploy == 'true'
uses: docker/setup-buildx-action@v3
with:
platforms: linux/arm64
- name: "🔨 Install dependencies"
if: steps.changes.outputs.deployRequired == 'true' || github.event.inputs.force_deploy == 'true'
run: bun install --frozen-lockfile
- name: "🔨 Build the SDK"
if: steps.changes.outputs.deployRequired == 'true' || github.event.inputs.force_deploy == 'true'
run: bun run build:sdk
- name: "👥 Configure AWS Credentials"
if: steps.changes.outputs.deployRequired == 'true' || github.event.inputs.force_deploy == 'true'
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"
if: steps.changes.outputs.deployRequired == 'true' || github.event.inputs.force_deploy == 'true'
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: "🔧 Setup environment"
if: steps.changes.outputs.deployRequired == 'true' || github.event.inputs.force_deploy == 'true'
shell: bash
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "STAGE=prod" >> $GITHUB_ENV
echo "ELYSIA_REPO=backend-elysia-prod" >> $GITHUB_ENV
else
echo "STAGE=dev" >> $GITHUB_ENV
echo "ELYSIA_REPO=backend-elysia-dev" >> $GITHUB_ENV
fi
if [[ "${{ steps.changes.outputs.backend }}" == "true" ]]; then
echo "BACKEND_IMAGE_TAG=${{ github.sha }}" >> $GITHUB_ENV
else
echo "BACKEND_IMAGE_TAG=latest" >> $GITHUB_ENV
fi
echo "Deployment stage : ${{ env.STAGE }}"
echo "Elysia rep : ${{ env.ELYSIA_REPO }}"
echo "Backend image tag : ${{ env.BACKEND_IMAGE_TAG }}"
- name: "🔨 Build Elysia backend"
if: steps.changes.outputs.backend == 'true' || github.event.inputs.force_deploy == 'true'
uses: docker/build-push-action@v6
with:
file: ./infra/docker/ElysiaDockerfile
platforms: linux/arm64
push: true
tags: |
262732185023.dkr.ecr.eu-west-1.amazonaws.com/${{ env.ELYSIA_REPO }}:latest
262732185023.dkr.ecr.eu-west-1.amazonaws.com/${{ env.ELYSIA_REPO }}:${{ github.sha }}
# Github actions cache
cache-from: type=gha
cache-to: type=gha,mode=min
build-args: |
STAGE=${{ env.STAGE }}
env:
STAGE: ${{ env.STAGE }}
- name: "🚀 SST Deploy"
if: steps.changes.outputs.deployRequired == 'true' || github.event.inputs.force_deploy == 'true'
run: |
STAGE=${STAGE_OVERRIDE:-$STAGE}
echo "Deploying with stage: $STAGE"
bun sst install
bun sst deploy --stage $STAGE
env:
STAGE: ${{ env.STAGE }}
ELYSIA_REPO: ${{ env.ELYSIA_REPO }}
BACKEND_IMAGE_TAG: ${{ env.BACKEND_IMAGE_TAG }}