v2024.02.16 #36
Workflow file for this run
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 to ECS | |
on: | |
release: | |
types: [ published ] | |
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 | |
continue-on-error: true | |
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: live | |
REGION: us-east-1 | |
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.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.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 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 |