Skip to content

Commit

Permalink
Add base github action
Browse files Browse the repository at this point in the history
  • Loading branch information
ihavecoke committed Jun 13, 2024
1 parent 6e87e8b commit 3c6630c
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .github/workflows/autocorrect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: AutoCorrect
on: [pull_request]
jobs:
autocorrect:
name: Check text autocorrect
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Check
uses: huacnlee/autocorrect-action@main
with:
use_npm: true

- name: Report ReviewDog
if: failure()
uses: huacnlee/autocorrect-action@main
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
use_npm: true
reviewdog: true
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build
on:
pull_request:
push:
branches:
- "!main"
- "!canary"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build Test
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn

- name: install dependency npm
run: yarn

- name: build canary env dist file
run: |
yarn build:canary
48 changes: 48 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy Canary
on:
push:
branches:
- main
- canary

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
deploy_canary:
name: build
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Download ossutils zip
run: |
wget https://github.com/aliyun/ossutil/releases/download/v1.7.17/ossutil-v1.7.17-linux-amd64.zip
unzip ossutil-v1.7.17-linux-amd64.zip && cp ./ossutil-v1.7.17-linux-amd64/ossutil ${{github.workspace}}/ && chmod +x ${{github.workspace}}/ossutil
- name: Test ossutil cli is ok
run: |
${{github.workspace}}/ossutil --version
- uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn

- name: install dependency npm
run: yarn

- name: build canary env dist file
env:
PROXY: canary
run: |
yarn build
- name: upload canary dist to oss
run: |
${{github.workspace}}/ossutil cp dist/ oss://lb-assets/github/canary/longportapp.com/learn/wiki/ -u -r -j 10 -e oss-cn-hangzhou.aliyuncs.com -i ${{ secrets.FE_LB_ASSET_ACCESS_KEY_ID }} -k ${{ secrets.FE_LB_ASSET_ACCESS_KEY_SECRET }} --exclude "*.html" --meta=Cache-Control:max-age=31536000
${{github.workspace}}/ossutil cp dist/ oss://lb-assets/github/canary/longportapp.com/learn/wiki/ -u -r -j 10 -e oss-cn-hangzhou.aliyuncs.com -i ${{ secrets.FE_LB_ASSET_ACCESS_KEY_ID }} -k ${{ secrets.FE_LB_ASSET_ACCESS_KEY_SECRET }} --include "*.html" --meta=Cache-Control:no-cache
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy Release
on:
push:
branches:
- release

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
deploy_release:
name: build
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn

- name: Download ossutils zip
run: |
wget https://github.com/aliyun/ossutil/releases/download/v1.7.17/ossutil-v1.7.17-linux-amd64.zip
unzip ossutil-v1.7.17-linux-amd64.zip && cp ./ossutil-v1.7.17-linux-amd64/ossutil ${{github.workspace}}/ && chmod +x ${{github.workspace}}/ossutil
- name: Test ossutil cli is ok
run: |
${{github.workspace}}/ossutil --version
- name: install dependency npm
run: yarn

- name: build release env dist file
env:
PROXY: release
run: yarn build

- name: upload canary dist to oss
run: |
${{github.workspace}}/ossutil cp dist/ oss://lb-assets/github/release/longportapp.com/learn/wiki/ -u -r -j 10 -e oss-cn-hangzhou.aliyuncs.com -i ${{ secrets.FE_LB_ASSET_ACCESS_KEY_ID }} -k ${{ secrets.FE_LB_ASSET_ACCESS_KEY_SECRET }} --exclude "*.html" --meta=Cache-Control:max-age=31536000
${{github.workspace}}/ossutil cp dist/ oss://lb-assets/github/release/longportapp.com/learn/wiki/ -u -r -j 10 -e oss-cn-hangzhou.aliyuncs.com -i ${{ secrets.FE_LB_ASSET_ACCESS_KEY_ID }} -k ${{ secrets.FE_LB_ASSET_ACCESS_KEY_SECRET }} --include "*.html" --meta=Cache-Control:no-cache
2 changes: 1 addition & 1 deletion docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const i18n = require("./i18n/config");


const isDev = process.env.NODE_ENV !== "production";
const targetPortalPath = process.env.Proxy === "canary" ? "https://m.longbridge.xyz" : "https://m.lbkrs.com";
const targetPortalPath = process.env.PROXY === "canary" ? "https://m.longbridge.xyz" : "https://m.lbkrs.com";
const localAPIProxyPath = "/dev-proxy";
const apiProxyUrl = `${isDev ? localAPIProxyPath : targetPortalPath}/api/forward`;

Expand Down

0 comments on commit 3c6630c

Please sign in to comment.