From 0231bf5d9c61cabd9b12022faa1c5e4355784f4d Mon Sep 17 00:00:00 2001 From: Rinat Arsaev <11846445+KrickRay@users.noreply.github.com> Date: Wed, 12 Jan 2022 15:49:47 +0300 Subject: [PATCH] TECHDEBT-28: Add deploy (#6) --- .github/actions/init/action.yaml | 21 +++++++++++ .github/workflows/build-push.yaml | 53 +++++++++++++-------------- .github/workflows/pr-build-check.yaml | 20 ++++++++++ .github/workflows/pr.yaml | 19 +++++----- Dockerfile | 3 ++ package.json | 2 +- renovate.json | 25 +++++-------- 7 files changed, 89 insertions(+), 54 deletions(-) create mode 100644 .github/actions/init/action.yaml create mode 100644 .github/workflows/pr-build-check.yaml create mode 100644 Dockerfile diff --git a/.github/actions/init/action.yaml b/.github/actions/init/action.yaml new file mode 100644 index 00000000..a45142e1 --- /dev/null +++ b/.github/actions/init/action.yaml @@ -0,0 +1,21 @@ +name: Init +description: Init +runs: + using: composite + steps: + - name: Init Thrift + uses: valitydev/action-setup-thrift@v0.0.1 + + - name: Init NodeJS + uses: actions/setup-node@v2 + with: + node-version: '16.4.2' + cache: 'npm' + + - name: Install Packages + run: npm ci + shell: bash + + - name: Compile Thrift + run: npm run compile + shell: bash diff --git a/.github/workflows/build-push.yaml b/.github/workflows/build-push.yaml index 1cc96c25..8a08d4fa 100644 --- a/.github/workflows/build-push.yaml +++ b/.github/workflows/build-push.yaml @@ -1,32 +1,31 @@ -name: Build +name: Build & Push on: - push: - branches: [master] - pull_request: - branches: ["*"] - + push: + branches: + - 'master' + - 'main' +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 - - name: Init Thrift - uses: valitydev/action-setup-thrift@v0.0.1 + - name: Init + uses: ./.github/actions/init - - name: Init NodeJS - uses: actions/setup-node@v2 - with: - node-version: '16.4.2' - cache: 'npm' + - name: Check & Build + run: npm run ci:build - - name: Install Packages - run: npm ci - - - name: Compile Thrift - run: npm run compile - - - name: Check & Build - run: npm run ci:build + - name: Deploy image + uses: valitydev/action-deploy-docker@v1.0.16 + with: + registry-username: ${{ github.actor }} + registry-access-token: ${{ secrets.GITHUB_TOKEN }} + dockerfile-path: . + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} diff --git a/.github/workflows/pr-build-check.yaml b/.github/workflows/pr-build-check.yaml new file mode 100644 index 00000000..f0431d23 --- /dev/null +++ b/.github/workflows/pr-build-check.yaml @@ -0,0 +1,20 @@ +name: 'PR: Build & Check' +on: + pull_request: + branches: ['*'] +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Init + uses: ./.github/actions/init + + - name: Check & Build + run: npm run ci:build diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 5fb130b0..b4b005a6 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -1,13 +1,12 @@ name: 'PR Title Checker' on: - pull_request: - types: [edited, opened, synchronize, reopened] - branches: [disabled] - + pull_request: + types: [edited, opened, synchronize, reopened] + branches: [disabled] jobs: - title-check: - runs-on: ubuntu-latest - steps: - - uses: naveenk1223/action-pr-title@master - with: - regex: '([A-Z]+-[0-9]+,?)+: [A-Z0-9].*' + title-check: + runs-on: ubuntu-latest + steps: + - uses: naveenk1223/action-pr-title@master + with: + regex: '([A-Z]+-[0-9]+,?)+: [A-Z0-9].*' diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..88283828 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:1.21 +COPY dist /usr/share/nginx/html +COPY nginx.conf /etc/nginx/vhosts.d/control-center.conf \ No newline at end of file diff --git a/package.json b/package.json index 427d4aff..bbccf236 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "lint": "eslint \"src/**/*.{ts,js,html}\" --max-warnings 2070 --cache", "lint-errors": "npm run lint -- --quiet --format codeframe", "lint-fix": "npm run lint -- --fix", - "prettier-preset": "prettier \"**/*.{html,js,ts,css,scss,md,json,prettierrc,svg,huskyrc}\"", + "prettier-preset": "prettier \"**/*.{html,js,ts,css,scss,md,json,prettierrc,svg,huskyrc,yml,yaml}\"", "prettier": "npm run prettier-preset -- --list-different", "prettier:fix": "npm run prettier-preset -- --write", "fix": "npm run lint-fix; npm run prettier:fix", diff --git a/renovate.json b/renovate.json index a125a31b..3352e5b4 100644 --- a/renovate.json +++ b/renovate.json @@ -1,18 +1,11 @@ { - "extends": [ - "config:base" - ], - "packageRules": [ - { - "matchPackagePatterns": [ - "*" - ], - "matchUpdateTypes": [ - "minor", - "patch" - ], - "groupName": "all non-major dependencies", - "groupSlug": "all-minor-patch" - } - ] + "extends": ["config:base"], + "packageRules": [ + { + "matchPackagePatterns": ["*"], + "matchUpdateTypes": ["minor", "patch"], + "groupName": "all non-major dependencies", + "groupSlug": "all-minor-patch" + } + ] }