Skip to content
GitHub Actions for Tencent COS Command (coscmd)
Shell Dockerfile
Use this GitHub Action with your project

Add this Action to an existing workflow or create a new one.

View on Marketplace
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.dockerignore
.gitignore
Dockerfile
LICENSE
README.md
action.yml
entrypoint.sh

README.md

简介

GitHub Action 用于调用腾讯云 coscmd 工具,实现对象存储的批量上传、下载、删除等操作。

workflow 示例

在目标仓库中创建 .github/workflows/xxx.yml 即可,文件名任意,配置参考如下:

name: CI

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout master
        uses: actions/checkout@v2
        with:
          ref: master

      - name: Setup node
        uses: actions/setup-node@v1
        with:
          node-version: "10.x"

      - name: Build project
        run: yarn && yarn build

      - name: Upload COS
        uses: zkqiang/tencent-cos-action@master
        with:
          args: delete -r -f / && upload -r ./dist/ /
          secret_id: ${{ secrets.SECRET_ID }}
          secret_key: ${{ secrets.SECRET_KEY }}
          bucket: ${{ secrets.BUCKET }}
          region: ap-shanghai

其中 ${{ secrets.SECRET_XXX }} 是调用 settings 配置的密钥,防止公开代码将权限密钥暴露,添加方式如下:

相关参数

以下参数均可参见 coscmd 官方文档

参数 是否必传 备注
args coscmd 命令参数,参见官方文档,多个命令用 && 隔开
delete -r -f / && upload -r ./dist/ /
secret_id 控制台-API密钥管理 获取
secret_key 同上
bucket 对象存储桶的名称,包含后边的数字
region 对象存储桶的地区,参见文档
You can’t perform that action at this time.