feat(web): remove web-server and change web to a static website deployment (#1360)

* feat(web): add deploying static app

* fix(web): linter ignore patterns

* fix(web): cloudfront invalidation and favicons placement

* feat(web-server): remove web-server package in favour of web

* fix(web): remove linter parallel jobs due to oom issue

* fix(mobile): eslintignore paths

* fix(web): copy of components

* fix(web): include building components in building all process

* fix(web): copying of components
This commit is contained in:
Karol Sójko
2022-08-03 14:51:59 +02:00
committed by GitHub
parent 3116ae3883
commit 483cac90cf
110 changed files with 87 additions and 2762 deletions

View File

@@ -14,8 +14,6 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: yarn install --immutable
- name: Build

View File

@@ -1,4 +1,4 @@
name: Web Server Deploy
name: Web Deploy
concurrency:
group: prod_environment
@@ -7,9 +7,9 @@ concurrency:
on:
push:
tags:
- '*standardnotes/*web-server*'
- '!*standardnotes/*web-server*beta*'
- '!*standardnotes/*web-server*alpha*'
- '*standardnotes/*web*'
- '!*standardnotes/*web*beta*'
- '!*standardnotes/*web*alpha*'
jobs:
test:
@@ -17,62 +17,42 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: yarn install
run: yarn install --immutable
- name: Build
run: yarn build:web-server
run: yarn build:web
- name: ESLint
run: yarn lint
- name: Test
run: yarn test
deploy:
runs-on: ubuntu-latest
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Copy robots.txt
run: cp packages/web-server/public/robots.txt.production packages/web-server/public/robots.txt
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: standardnotes/web
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "stable,${{ github.sha }}"
- 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: us-east-1
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition app-prod --query taskDefinition > task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: app-prod
image: "standardnotes/web:${{ github.sha }}"
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: app-prod
cluster: prod
wait-for-service-stability: true
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: yarn install --immutable
- name: Build
run: yarn build:web
- 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: us-east-1
- name: Deploy static site to S3 bucket
run: aws s3 sync packages/web/dist/ s3://app-static.standardnotes.com --delete
- name: Invalidate CloudFront Cache
uses: chetan/invalidate-cloudfront-action@master
env:
DISTRIBUTION: ${{ secrets.WEBAPP_CLOUDFRONT_DISTRIBUTION_ID }}
PATHS: '/*'
AWS_REGION: 'us-east-1'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
notify_discord:
needs: deploy

View File

@@ -1,83 +0,0 @@
name: Web Server TestFlight
concurrency:
group: dev_environment
cancel-in-progress: true
on:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: yarn install
- name: Build
run: yarn build:web-server
- name: ESLint
run: yarn lint
- name: Test
run: yarn test
deploy:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
- name: Copy robots.txt
run: cp packages/web-server/public/robots.txt.development packages/web-server/public/robots.txt
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: standardnotes/web
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "latest,${{ github.sha }}"
- 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: us-east-1
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition app-dev --query taskDefinition > task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: app-dev
image: "standardnotes/web:${{ github.sha }}"
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: app-dev
cluster: dev
wait-for-service-stability: true
notify_discord:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Run Discord Webhook
uses: johnnyhuy/actions-discord-git-webhook@main
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}

View File

@@ -1,20 +0,0 @@
name: Web Server PR
on:
pull_request:
branches:
- main
paths:
- 'packages/web-server/**'
jobs:
TestDockerBuild:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Copy default configuration
run: yarn workspace @standardnotes/web-server run sample:env
- name: Test build of the image
run: docker build -t standardnotes/web:test-build .