compiler: fix mobile hash bug #2136
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Build CI | |
on: | |
push: | |
paths: | |
- '**' | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: "Why trigger?" | |
required: true | |
type: string | |
env: | |
IMAGE: "docs" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: | |
- 12.x | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install pnpm | |
run: npm install -g pnpm@6 | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
run: | | |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | |
key: docs-${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
docs-${{ runner.os }}-pnpm-store- | |
- name: Get current branch | |
id: get_branch | |
run: | | |
if [ "$GITHUB_EVENT_NAME" == "push" ]; then | |
echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
elif [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then | |
echo "BRANCH=$GITHUB_HEAD_REF" >> $GITHUB_ENV | |
fi | |
- name: Node build | |
shell: bash | |
run: | | |
pnpm install gray-matter json2yaml | |
node addTime.js | |
node addTime.js ./translate/translated | |
node copy-file.js ./docs/zh ./translate/translated false | |
rm -rf translate/translated/README.md | |
mv translate/translated/* ./docs | |
rm -rf ./docs/map.txt | |
pnpm install | |
node downloadFile.js ${{ env.BRANCH }} | |
node downloadCSV.js ${{ env.BRANCH }} | |
pnpm run build | |
node copy-file.js | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to ALIYUN Docker Registry | |
if: ${{ github.repository == 'deepflowio/docs'}} | |
uses: docker/login-action@v2 | |
with: | |
registry: "${{ secrets.REGISTRY_ALIYUN_ADDR }}" | |
username: "${{ secrets.REGISTRY_ALIYUN_USER }}" | |
password: "${{ secrets.ALIYUN_DF_CLOUD_REGISTRY_PASSWORD }}" | |
# - name: debug | |
# shell: bash | |
# run: | | |
# more $GITHUB_EVENT_PATH | |
- name: set env | |
if: ${{ github.event_name == 'pull_request' && github.repository == 'deepflowio/docs' && github.event.pull_request.base.ref == 'main' }} | |
run: | | |
echo "IMAGE_TAG_PREFIX=${{ github.event.pull_request.head.ref }}"|sed 's|main|latest|' >> $GITHUB_ENV | |
- name: set env | |
if: ${{ github.event_name == 'push' && github.repository == 'deepflowio/docs'}} | |
run: | | |
echo "IMAGE_TAG_PREFIX=${{ github.ref_name }}"|sed 's|main|latest|' >> $GITHUB_ENV | |
- name: set env | |
if: ${{ github.event_name == 'workflow_dispatch' && github.repository == 'deepflowio/docs'}} | |
run: | | |
echo "IMAGE_TAG_PREFIX=${{ github.ref_name }}"|sed 's|main|latest|' >> $GITHUB_ENV | |
- name: Build and push docs image | |
if: ${{ github.repository == 'deepflowio/docs'}} | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
"${{ secrets.REGISTRY_ALIYUN_ADDR }}/deepservice/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}-${{ github.run_id }}-${{ github.run_attempt }}" | |
"${{ secrets.REGISTRY_ALIYUN_ADDR }}/deepservice/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}" | |
- name: template | |
if: ${{ github.event_name == 'pull_request' }} | |
shell: bash | |
run: | | |
echo "TEMPLATE=red" >> $GITHUB_ENV | |
- name: template | |
if: ${{ github.event_name == 'push' }} | |
shell: bash | |
run: | | |
echo "TEMPLATE=green" >> $GITHUB_ENV | |
- name: info | |
shell: bash | |
if: ${{ github.repository == 'deepflowio/docs'}} | |
run: | | |
curl -X POST -H "Content-Type: application/json" -d \ | |
'{"msg_type":"interactive","card": | |
{ | |
"config": { | |
"wide_screen_mode": true | |
}, | |
"elements": [ | |
{ | |
"tag": "div", | |
"text": { | |
"content": "docs分支: ${{ github.ref_name }}\n镜像tag:${{ github.run_id }}-${{ github.run_attempt }}\nmain分支自动更新到测试环境\n更新命令:\nkubectl set image -n deepservice-test deployment deepservice-docs deepservice-docs=${{ secrets.REGISTRY_ALIYUN_ADDR }}/deepservice/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}-${{ github.run_id }}-${{ github.run_attempt }}", | |
"tag": "lark_md" | |
} | |
} | |
], | |
"header": { | |
"template": "${{ env.TEMPLATE }}", | |
"title": { | |
"content": "👻DeepFlow (Community)-docs ${{ github.event_name }} 事件", | |
"tag": "plain_text" | |
} | |
} | |
} | |
}' \ | |
${{ secrets.FEISHU_ROBOT }} | |
- name: set kubeconfig | |
if: ${{ github.repository == 'deepflowio/docs'}} | |
shell: bash | |
run: | | |
mkdir -p ~/.kube | |
echo "${{ secrets.DEEPFLOWIOKUBECONFIG}}" >> ~/.kube/config | |
- name: update | |
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main' && github.repository == 'deepflowio/docs' && github.event.pull_request.merged == true }} | |
shell: bash | |
run: | | |
kubectl set image -n deepservice-test deployment deepservice-docs deepservice-docs=${{ secrets.REGISTRY_ALIYUN_ADDR }}/deepservice/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}-${{ github.run_id }}-${{ github.run_attempt }} | |
- name: update | |
if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && github.repository == 'deepflowio/docs' }} | |
shell: bash | |
run: | | |
kubectl set image -n deepservice deployment deepservice-docs deepservice-docs=${{ secrets.REGISTRY_ALIYUN_ADDR }}/deepservice/${{ env.IMAGE }}:${{ env.IMAGE_TAG_PREFIX }}-${{ github.run_id }}-${{ github.run_attempt }} |