GitHub Actions for Tencent COS Command (coscmd)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
zkqiang 0745085e73
Update README
3 years ago
.dockerignore First commit 4 years ago
.gitignore First commit 4 years ago
Dockerfile First commit 4 years ago
LICENSE First commit 4 years ago
README.md Update README 3 years ago
action.yml First commit 4 years ago
entrypoint.sh First commit 4 years ago

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@v0.1.0
        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 对象存储桶的地区,参见文档