Skip to content

v2024.02.15

v2024.02.15 #129

Workflow file for this run

name: Deploy Staging
on:
release:
types: [ published ]
push:
branches:
- dev
- master
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'
- name: Install deps
run: |
npm install
npm run build-themes
- name: Update Chrome
run: |
sudo apt-get update
sudo apt-get --only-upgrade install google-chrome-stable
google-chrome --version
- name: Run E2E Tests
run: |
npm run e2e
- name: Build SSR
run: |
npm run build-prod:ssr
cp dist/frontend/browser/index.html dist/frontend/browser/404.html
- name: Upload dist artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
if-no-files-found: error
deploy:
runs-on: ubuntu-latest
needs: build
env:
CLUSTER_NAME: avrae
SERVICE_NAME: avrae-io
DEPLOY_ENV: stg
REGION: us-east-2
steps:
- uses: actions/checkout@v2
- name: Download build artifacts
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.STG_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.STG_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: avrae/${{ env.SERVICE_NAME }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $SERVICE_NAME .
docker tag $SERVICE_NAME $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag $SERVICE_NAME $ECR_REGISTRY/$ECR_REPOSITORY:$DEPLOY_ENV
docker tag $SERVICE_NAME $ECR_REGISTRY/$ECR_REPOSITORY:live
docker push -a $ECR_REGISTRY/$ECR_REPOSITORY
- name: Deploy Amazon ECS task definition
run: |
aws ecs update-service --cluster $CLUSTER_NAME-$DEPLOY_ENV --service $SERVICE_NAME --force-new-deployment --region $REGION