feat(portal): Load Balance #1237
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: CI | |
on: | |
pull_request: | |
branches: ['main'] | |
workflow_call: | |
inputs: | |
rebuild: | |
type: boolean | |
description: 'Rebuild all images' | |
required: false | |
default: false | |
secrets: | |
NPM_AUTH_TOKEN: | |
description: 'NPM Auth Token' | |
required: true | |
outputs: | |
bake_file_existence: | |
description: 'Docker bake file existence' | |
value: ${{ jobs.build.outputs.bake_file_existence}} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
bake_file_existence: ${{ steps.bake_file_existence.outputs.files_exists }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Git config user | |
uses: snow-actions/git-config-user@v1.0.0 | |
with: | |
name: NTNL Infra # Service Account's Name | |
email: infra@ntnl.io # Service Account's Email Address | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.17.0 | |
- name: Cache Rush | |
uses: actions/cache@v3 | |
with: | |
path: | | |
common/temp/install-run | |
~/.rush | |
key: ${{ runner.os }}-${{ hashFiles('rush.json') }} | |
- name: Cache Rush Build Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
common/temp/build-cache | |
key: ${{ runner.os }}-rush-build-cache-${{ github.sha}} | |
restore-keys: | | |
${{ runner.os }}-rush-build-cache- | |
- name: Cache pnpm | |
uses: actions/cache@v3 | |
with: | |
path: | | |
common/temp/pnpm-store | |
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
- name: Verify Change Logs | |
run: node common/scripts/install-run-rush.js change --verify | |
- name: Rush Install | |
run: node common/scripts/install-run-rush.js install | |
- name: Rush rebuild | |
if: ${{ inputs.rebuild }} | |
env: | |
REGISTRY: ghcr.io | |
REGISTRY_NAMESPACE: no-trade-no-life | |
CI_RUN: 'true' | |
run: node common/scripts/install-run-rush.js rebuild --verbose | |
- name: Rush build | |
if: ${{ !inputs.rebuild }} | |
env: | |
REGISTRY: ghcr.io | |
REGISTRY_NAMESPACE: no-trade-no-life | |
CI_RUN: 'true' | |
NODE_OPTIONS: '--max-old-space-size=8192' | |
run: node common/scripts/install-run-rush.js build --verbose | |
- name: Check docker bake file existence | |
id: bake_file_existence | |
uses: andstor/file-existence-action@v2 | |
with: | |
files: './common/temp/docker-bake.json' | |
- name: package docker deploy artifacts | |
if: ${{ steps.bake_file_existence.outputs.files_exists == 'true' }} | |
run: | | |
tar -zcvf ./common/temp/docker-deploy.tar.gz \ | |
./common/temp/docker-bake.json \ | |
./common/temp/out | |
- name: Upload docker artifacts | |
uses: actions/upload-artifact@v3 | |
if: ${{ steps.bake_file_existence.outputs.files_exists == 'true' }} | |
with: | |
name: docker-artifacts | |
retention-days: 1 | |
path: | | |
./common/temp/docker-deploy.tar.gz | |
- name: Upload web artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: web-artifacts | |
retention-days: 1 | |
path: | | |
./ui/web/dist | |
if-no-files-found: error | |
- name: Upload docs artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docs-artifacts | |
retention-days: 1 | |
path: | | |
./ui/docs/build | |
if-no-files-found: error | |
- name: Publish NPM Package | |
if: ${{ github.ref == 'refs/heads/main' }} | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
run: node common/scripts/install-run-rush.js publish -p --include-all |