Skip to content

Update the description of platform support for compressed textures. #164

Update the description of platform support for compressed textures.

Update the description of platform support for compressed textures. #164

name: 全量发布到华为云
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
deploy:
if: contains(github.event.head_commit.message, 'publish:all')
runs-on: ubuntu-latest
strategy:
matrix:
publish-version: ['3.8', '3.7', '3.6', '3.5', '3.4', '3.3', '3.2', '3.1', '3.0', '2.4']
steps:
- uses: actions/checkout@v4
- name: 设置 node 环境
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: 安装依赖
run: npm install
- name: 构建项目 (测试环境)
if: contains(github.event.head_commit.message, 'publish:all:test')
run: node scripts/publish.js --version=versions/${{ matrix.publish-version }}
- name: 构建项目 (正式环境)
if: contains(github.event.head_commit.message, 'publish:all:pro')
run: node scripts/publish.js --version=versions/${{ matrix.publish-version }}
- name: 登录华为云
uses: huaweicloud/[email protected]
with:
access_key_id: ${{ secrets.ACCESSKEY }}
secret_access_key: ${{ secrets.SECRETACCESSKEY }}
region: 'cn-north-4'
# 按版本上传到对应的文件去
- name: 上传文件到华为云 (测试环境)
if: contains(github.event.head_commit.message, 'publish:all:test')
uses: ./.github/actions/obs-helper
with:
bucket_name: 'cce-creator-docs-test'
local_file_path: ./versions/${{ matrix.publish-version }}/.vitepress/dist
obs_file_path: gitbook/creator/${{ matrix.publish-version }}/manual/
operation_type: upload
include_self_folder: false
- name: 上传文件到华为云(正式环境)
if: contains(github.event.head_commit.message, 'publish:all:pro')
uses: ./.github/actions/obs-helper
with:
bucket_name: 'cce-creator-docs-pro'
local_file_path: ./versions/${{ matrix.publish-version }}/.vitepress/dist
obs_file_path: gitbook/creator/${{ matrix.publish-version }}/manual/
operation_type: upload
include_self_folder: false
- name: Get Huawei Cloud IAM Token
id: get-token
env:
HWCLOUD_USERNAME: ${{ secrets.HUAWEI_CLOUD_USERNAME }}
HWCLOUD_PASSWORD: ${{ secrets.HUAWEI_CLOUD_PASSWORD }}
HWCLOUD_DOMAIN_NAME: ${{ secrets.HUAWEI_CLOUD_DOMAIN_NAME }}
HWCLOUD_PROJECT_ID: ${{ secrets.HUAWEI_CLOUD_PROJECT_ID }}
IAM_ENDPOINT: 'https://iam.myhuaweicloud.com/v3/auth/tokens'
run: |
PAYLOAD="{\"auth\":{\"identity\":{\"methods\":[\"password\"],\"password\":{\"user\":{\"name\":\"$HWCLOUD_USERNAME\",\"password\":\"$HWCLOUD_PASSWORD\",\"domain\":{\"name\":\"$HWCLOUD_DOMAIN_NAME\"}}}},\"scope\":{\"project\":{\"id\":\"$HWCLOUD_PROJECT_ID\"}}}}"
IAM_RESPONSE=$(curl -si -X POST "$IAM_ENDPOINT" \
-H "Content-Type: application/json" \
-d "$PAYLOAD")
IAM_TOKEN=$(echo "$IAM_RESPONSE" | grep X-Subject-Token: | awk '{print $2}' | tr -d '\r')
if [ -z "$IAM_TOKEN" ]; then
echo "Failed to get IAM token"
exit 1
fi
echo "::add-mask::$IAM_TOKEN"
echo "::set-output name=IAM_TOKEN::$IAM_TOKEN"
- name: Refresh CDN Cache
if: success() && steps.get-token.outputs.IAM_TOKEN
env:
CDN_ENDPOINT: 'https://cdn.myhuaweicloud.com/v1.0/cdn/content/refresh-tasks'
IAM_TOKEN: ${{ steps.get-token.outputs.IAM_TOKEN }}
run: |
CDN_PAYLOAD="{\"refresh_task\":{\"type\":\"directory\",\"urls\":[\"https://docs.cocos.com/\"]}}"
CDN_RESPONSE=$(curl -si -X POST "$CDN_ENDPOINT" \
-H "Content-Type: application/json" \
-H "X-Auth-Token: $IAM_TOKEN" \
-d "$CDN_PAYLOAD")
echo "$CDN_RESPONSE"