Skip to content

Commit

Permalink
feat(project): support America deploy (#1436)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackHole1 authored Mar 22, 2022
1 parent d0fed00 commit 53c84b1
Show file tree
Hide file tree
Showing 62 changed files with 381 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- "packages/flat-components/src/**"
- "packages/flat-i18n/locales/**"
- "packages/flat-types/src/**"
- ".github/workflows/deploy-web-dev.yml"
- ".github/workflows/deploy-web-dev-cn.yml"

jobs:
deploy-flat-web-dev:
Expand All @@ -29,7 +29,7 @@ jobs:
yarn run bootstrap || yarn run bootstrap || yarn run bootstrap
- name: Build flat web development
run: yarn workspace flat-web build -m development
run: yarn workspace flat-web build:cn -m development

- name: Log in to Docker Hub
uses: docker/login-action@v1
Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/deploy-web-dev-us.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Deploy Flat Web Dev
on:
push:
branches:
- "main"
paths:
- "config/**"
- "web/flat-web/**"
- "packages/flat-components/src/**"
- "packages/flat-i18n/locales/**"
- "packages/flat-types/src/**"
- ".github/workflows/deploy-web-dev-us.yml"

jobs:
deploy-flat-web-dev:
environment: development

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install dependencies
run: |
node ./scripts/ci/remove-workspace-packages.js web
node ./scripts/ci/remove-package-scripts-hooks.js
# failure automatically retries 3 times
yarn run bootstrap || yarn run bootstrap || yarn run bootstrap
- name: Build flat web development
run: yarn workspace flat-web build:us -m development

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Reset dockerignore
run: |
echo "*" > .dockerignore
echo "!web/flat-web/dist" >> .dockerignore
echo "!web/flat-web/deploy/nginx" >> .dockerignore
- name: Build and push images
env:
COMMIT_SHA_TAG: development-${{ github.sha }}
LATEST_DEV_TAG: dev-latest
PRIVATE_DOCKERHUB_REGISTRY: ${{ secrets.PRIVATE_DOCKERHUB_REGISTRY }}
PRIVATE_DOCKERHUB_USERNAME: ${{ secrets.PRIVATE_DOCKERHUB_USERNAME }}
PRIVATE_DOCKERHUB_PASSWORD: ${{ secrets.PRIVATE_DOCKERHUB_PASSWORD }}
run: |
docker build . -f web/flat-web/deploy/Dockerfile -t agoraflat/flat-web-us:$COMMIT_SHA_TAG -t agoraflat/flat-web-us:$LATEST_DEV_TAG -t $PRIVATE_DOCKERHUB_REGISTRY/agoraflat/flat-web-us:$COMMIT_SHA_TAG -t $PRIVATE_DOCKERHUB_REGISTRY/agoraflat/flat-web-us:$LATEST_DEV_TAG
docker push agoraflat/flat-web-us:$COMMIT_SHA_TAG
docker push agoraflat/flat-web-us:$LATEST_DEV_TAG
docker login -u $PRIVATE_DOCKERHUB_USERNAME -p $PRIVATE_DOCKERHUB_PASSWORD $PRIVATE_DOCKERHUB_REGISTRY
docker push $PRIVATE_DOCKERHUB_REGISTRY/agoraflat/flat-web-us:$COMMIT_SHA_TAG
docker push $PRIVATE_DOCKERHUB_REGISTRY/agoraflat/flat-web-us:$LATEST_DEV_TAG
- name: Prep helm chart
env:
DOCKER_IMAGE_NAME: ${{ secrets.PRIVATE_DOCKERHUB_REGISTRY }}/agoraflat/flat-web-us
DOCKER_IMAGE_TAG: development-${{ github.sha }}
run: |
export APPVERSION=development-${{ github.sha }}
export CHART=./web/flat-web/helm/Chart.yaml
sed -i "s/^appVersion:.*$/appVersion: $APPVERSION/" $CHART
export VALUE=./web/flat-web/helm/values.yaml
sed -i "s|DOCKER_IMAGE_NAME|$DOCKER_IMAGE_NAME|" $VALUE
sed -i "s|DOCKER_IMAGE_TAG|$DOCKER_IMAGE_TAG|" $VALUE
- name: Deploy
uses: WyriHaximus/github-action-helm3@v2
with:
exec: helm upgrade flat-web ./web/flat-web/helm --install --wait --atomic --namespace=default
kubeconfig: '${{ secrets.KUBECONFIG_US }}'
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- "packages/flat-components/src/**"
- "packages/flat-i18n/locales/**"
- "packages/flat-types/src/**"
- ".github/workflows/deploy-web-prod.yml"
- ".github/workflows/deploy-web-prod-cn.yml"

jobs:
deploy-flat-web-prod:
Expand All @@ -29,7 +29,7 @@ jobs:
yarn run bootstrap || yarn run bootstrap || yarn run bootstrap
- name: Build flat web production
run: yarn workspace flat-web build -m production
run: yarn workspace flat-web build:cn -m production

- name: Log in to Docker Hub
uses: docker/login-action@v1
Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/deploy-web-prod-us.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Deploy Flat Web Prod
on:
push:
branches:
- "stable"
- "only-deploy-prod-web"
paths:
- "config/**"
- "web/flat-web/**"
- "packages/flat-components/src/**"
- "packages/flat-i18n/locales/**"
- "packages/flat-types/src/**"
- ".github/workflows/deploy-web-prod-us.yml"

jobs:
deploy-flat-web-prod:
environment: production
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install dependencies
run: |
node ./scripts/ci/remove-workspace-packages.js web
node ./scripts/ci/remove-package-scripts-hooks.js
# failure automatically retries 3 times
yarn run bootstrap || yarn run bootstrap || yarn run bootstrap
- name: Build flat web production
run: yarn workspace flat-web build:us -m production

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Reset dockerignore
run: |
echo "*" > .dockerignore
echo "!web/flat-web/dist" >> .dockerignore
echo "!web/flat-web/deploy/nginx" >> .dockerignore
- name: Build and push images production
env:
COMMIT_SHA_TAG: production-${{ github.sha }}
LATEST_PROD_TAG: latest
PRIVATE_DOCKERHUB_REGISTRY: ${{ secrets.PRIVATE_DOCKERHUB_REGISTRY }}
PRIVATE_DOCKERHUB_USERNAME: ${{ secrets.PRIVATE_DOCKERHUB_USERNAME }}
PRIVATE_DOCKERHUB_PASSWORD: ${{ secrets.PRIVATE_DOCKERHUB_PASSWORD }}
run: |
docker build . -f web/flat-web/deploy/Dockerfile -t agoraflat/flat-web-us:$COMMIT_SHA_TAG -t agoraflat/flat-web-us:$LATEST_PROD_TAG -t $PRIVATE_DOCKERHUB_REGISTRY/agoraflat/flat-web-us:$COMMIT_SHA_TAG -t $PRIVATE_DOCKERHUB_REGISTRY/agoraflat/flat-web-us:$LATEST_PROD_TAG
docker push agoraflat/flat-web-us:$COMMIT_SHA_TAG
docker push agoraflat/flat-web-us:$LATEST_PROD_TAG
docker login -u $PRIVATE_DOCKERHUB_USERNAME -p $PRIVATE_DOCKERHUB_PASSWORD $PRIVATE_DOCKERHUB_REGISTRY
docker push $PRIVATE_DOCKERHUB_REGISTRY/agoraflat/flat-web-us:$COMMIT_SHA_TAG
docker push $PRIVATE_DOCKERHUB_REGISTRY/agoraflat/flat-web-us:$LATEST_PROD_TAG
- name: Prep helm chart
env:
DOCKER_IMAGE_NAME: ${{ secrets.PRIVATE_DOCKERHUB_REGISTRY }}/agoraflat/flat-web-us
DOCKER_IMAGE_TAG: production-${{ github.sha }}
run: |
export APPVERSION=production-${{ github.sha }}
export CHART=./web/flat-web/helm/Chart.yaml
sed -i "s/^appVersion:.*$/appVersion: $APPVERSION/" $CHART
export VALUE=./web/flat-web/helm/values.yaml
sed -i "s|DOCKER_IMAGE_NAME|$DOCKER_IMAGE_NAME|" $VALUE
sed -i "s|DOCKER_IMAGE_TAG|$DOCKER_IMAGE_TAG|" $VALUE
- name: Deploy
uses: WyriHaximus/github-action-helm3@v2
with:
exec: helm upgrade flat-web ./web/flat-web/helm --install --wait --atomic --namespace=default
kubeconfig: '${{ secrets.KUBECONFIG_US }}'
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ dist
.yarn/install-state.gz
.pnp.*

# Icon must end with two \r
Icon

# Thumbnails
._*

Expand Down
32 changes: 32 additions & 0 deletions config/America/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
NETLESS_APP_IDENTIFIER=n9q1oBxDEeyuBMn1qc0iFw/fLgNSEvdwKjlig
AGORA_APP_ID=931b86d6781e49a2a255db4ce6e8e804
GITHUB_CLIENT_ID=0ac608815326aead5db7
WECHAT_APP_ID=wx1133c2153a45e9b8
AGORA_OAUTH_CLIENT_ID=flat-dev

CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY=LTAI5t9Gb6tzQzzLmB6cTVf7
CLOUD_STORAGE_OSS_ALIBABA_BUCKET=flat-storage
CLOUD_STORAGE_OSS_ALIBABA_REGION=oss-cn-hangzhou

CLOUD_STORAGE_DOMAIN=https://flat-storage-[region].whiteboard.agora.io

FLAT_SERVER_DOMAIN=api-dev.flat.agora.io
UPDATE_DOMAIN=https://flat-storage.oss-cn-hangzhou.aliyuncs.com/versions-america
FLAT_WEB_DOMAIN=web-dev.flat.agora.io

FLAT_DOWNLOAD_URL=https://flat.whiteboard.agora.io/#download

CLOUD_RECORDING_DEFAULT_AVATAR=https://flat-storage.oss-cn-hangzhou.aliyuncs.com/flat-resources/cloud-recording/default-avatar.jpg

SKIP_MAC_NOTARIZE=
APPLE_API_ISSUER=
APPLE_API_KEY=

WINDOWS_CODE_SIGNING_CA_PATH=
WINDOWS_CODE_SIGNING_CA_PASSWORD=

ARTIFACTS_ALIBABA_CLOUD_OSS_BUCKET=
ARTIFACTS_ALIBABA_CLOUD_OSS_REGION=
ARTIFACTS_ALIBABA_CLOUD_OSS_FOLDER=versions
ARTIFACTS_ALIBABA_CLOUD_OSS_ACCESS_KEY=
ARTIFACTS_ALIBABA_CLOUD_OSS_ACCESS_KEY_SECRET=
32 changes: 32 additions & 0 deletions config/America/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
NETLESS_APP_IDENTIFIER=cFjxAJjiEeuUQ0211QCRBw/mO9uJB_DiCIqug
AGORA_APP_ID=931b86d6781e49a2a255db4ce6e8e804
GITHUB_CLIENT_ID=da83d7e14217594fba46
WECHAT_APP_ID=wx96d522d69d384cce
AGORA_OAUTH_CLIENT_ID=flat

CLOUD_STORAGE_OSS_ALIBABA_ACCESS_KEY=LTAI5t9Gb6tzQzzLmB6cTVf7
CLOUD_STORAGE_OSS_ALIBABA_BUCKET=flat-storage
CLOUD_STORAGE_OSS_ALIBABA_REGION=oss-cn-hangzhou

CLOUD_STORAGE_DOMAIN=https://flat-storage-[region].whiteboard.agora.io

FLAT_SERVER_DOMAIN=api.flat.agora.io
UPDATE_DOMAIN=https://flat-storage.oss-cn-hangzhou.aliyuncs.com/versions-america
FLAT_WEB_DOMAIN=web.flat.agora.io

FLAT_DOWNLOAD_URL=https://flat.whiteboard.agora.io/#download

CLOUD_RECORDING_DEFAULT_AVATAR=https://flat-storage.oss-cn-hangzhou.aliyuncs.com/flat-resources/cloud-recording/default-avatar.jpg

SKIP_MAC_NOTARIZE=
APPLE_API_ISSUER=
APPLE_API_KEY=

WINDOWS_CODE_SIGNING_CA_PATH=
WINDOWS_CODE_SIGNING_CA_PASSWORD=

ARTIFACTS_ALIBABA_CLOUD_OSS_BUCKET=
ARTIFACTS_ALIBABA_CLOUD_OSS_REGION=
ARTIFACTS_ALIBABA_CLOUD_OSS_FOLDER=versions
ARTIFACTS_ALIBABA_CLOUD_OSS_ACCESS_KEY=
ARTIFACTS_ALIBABA_CLOUD_OSS_ACCESS_KEY_SECRET=
File renamed without changes.
File renamed without changes.
62 changes: 62 additions & 0 deletions desktop/main-app/electron-builder/America.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
appId: io.agora.flint
productName: Flint
artifactName: Flint-${version}.${ext}
asar: true

extraMetadata:
main: main.js

files:
- filter:
- package.json
- from: ./dist

mac:
category: public.app-category.productivity
hardenedRuntime: true
entitlements: entitlements.mac.plist
entitlementsInherit: entitlements.mac.plist
gatekeeperAssess: false
extendInfo:
LSHasLocalizedDisplayName: true
CFBundleURLTypes:
- CFBundleURLName: x-agora-flat-client
CFBundleURLSchemes:
- x-agora-flat-client
NSPrincipalClass: AtomApplication
target:
- dmg
- zip

dmg:
contents:
- { x: 130, y: 220 }
- { x: 410, y: 220, type: link, path: /Applications }

win:
target:
- target: zip
- target: nsis
arch:
- ia32

protocols:
- name: Agora Flat Client
schemes:
- x-agora-flat-client

nsis:
oneClick: false
perMachine: true
createDesktopShortcut: true
createStartMenuShortcut: true
allowToChangeInstallationDirectory: true
installerIcon: resources/install.ico
shortcutName: Flint
artifactName: Flint-${version}.${ext}

directories:
buildResources:

releaseInfo:
releaseNotes:
File renamed without changes.
5 changes: 5 additions & 0 deletions desktop/main-app/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "flat",
"productName": "Flat",
"version": "1.7.0",
"private": true,
"description": "",
Expand All @@ -13,7 +14,11 @@
},
"scripts": {
"start": "cross-env NODE_ENV=development webpack --config webpack/webpack.dev.js",
"start:cn": "cross-env FLAT_REGION=China yarn start",
"start:us": "cross-env FLAT_REGION=America yarn start",
"build": "cross-env NODE_ENV=production webpack --config webpack/webpack.prod.js",
"build:cn": "cross-env FLAT_REGION=China yarn build",
"build:us": "cross-env FLAT_REGION=America yarn build",
"build:debug": "cross-env FLAT_DEBUG=debug webpack --config webpack/webpack.debug.js",
"pack:win": "node ./scripts/pack win",
"pack:mac": "node ./scripts/pack mac",
Expand Down
Binary file removed desktop/main-app/resources/beta/icon.icns
Binary file not shown.
Binary file removed desktop/main-app/resources/beta/icon.ico
Binary file not shown.
Binary file removed desktop/main-app/resources/beta/icons/1024x1024.png
Binary file not shown.
Binary file removed desktop/main-app/resources/beta/icons/128x128.png
Binary file not shown.
Binary file removed desktop/main-app/resources/beta/icons/16x16.png
Binary file not shown.
Binary file removed desktop/main-app/resources/beta/icons/24x24.png
Binary file not shown.
Binary file removed desktop/main-app/resources/beta/icons/256x256.png
Binary file not shown.
Binary file removed desktop/main-app/resources/beta/icons/32x32.png
Binary file not shown.
Binary file removed desktop/main-app/resources/beta/icons/48x48.png
Binary file not shown.
Binary file removed desktop/main-app/resources/beta/icons/512x512.png
Binary file not shown.
Binary file removed desktop/main-app/resources/beta/icons/64x64.png
Binary file not shown.
Binary file removed desktop/main-app/resources/beta/icons/96x96.png
Binary file not shown.
Binary file added desktop/main-app/resources/icon/America/Icon.icns
Binary file not shown.
Binary file added desktop/main-app/resources/icon/America/icon.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions desktop/main-app/scripts/constant.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
const path = require("path");
const semver = require("semver");
const packageJSON = require("../package.json");

const agoraElectronSdkPath = path.join(require.resolve("agora-electron-sdk"), "..", "..");

const prerelease = semver.prerelease(packageJSON.version);
const releaseTag = prerelease === null ? "stable" : prerelease[0];

module.exports.agoraElectronSdkPath = agoraElectronSdkPath;
module.exports.releaseTag = releaseTag;
Loading

0 comments on commit 53c84b1

Please sign in to comment.