env: TZ:Asia/Shanghai# 时区 on: push: branches: -main
jobs: build: runs-on:ubuntu-latest name:Ajobtodeployblog. steps: -name:Checkout uses:actions/checkout@v3 with: submodules:true# Checkout private submodules(themes or something else). # Caching dependencies to speed up workflows. (GitHub will remove any cache entries that have not been accessed in over 7 days.) -name:Cachenodemodules uses:actions/cache@v3 id:cache with: path:node_modules key:${{runner.os}}-node-${{hashFiles('**/package-lock.json')}} restore-keys:| ${{ runner.os }}-node- -name:InstallDependencies if:steps.cache.outputs.cache-hit!='true' run:npmci
# Caching public -name:cachepublic id:cache-public uses:actions/cache@v3 with: path:| public db.json key:${{runner.os}}-public-${{hashFiles('**/db.json')}} restore-keys:| ${{ runner.os }}-public- # Hexo generate -name:Hexogenerate id:generate run:| npx hexo generate # Deploy hexo blog website. -name:Deploy id:deploy uses:TencentCloud/cos-action@v1 with: secret_id:${{secrets.TENCENT_CLOUD_SECRET_ID}} secret_key:${{secrets.TENCENT_CLOUD_SECRET_KEY}} cos_bucket:${{secrets.COS_BUCKET}} cos_region:${{secrets.COS_REGION}} local_path:public remote_path:/ # Optional Set to true for cleaning files on COS path which are not existed in local path. Default is false. # clean: true # Optional Set to true for using accelerate domain to upload files. Default is false. # accelerate: true
# Use the output from the `deploy` step(use for test action) -name:Gettheoutput run:| echo"${{ steps.deploy.outputs.notify }}"
steps: # check it to your workflow can access it # from: https://github.com/actions/checkout -name:CheckoutRepositorymasterbranch uses:actions/checkout@v2 with: ref:'master' submodules:true