Github 工作流程 CI/CD 失败

Github Workflows CI/CD failing

我的 CI/CD 管道正在使用 github 工作流失败并出现以下错误:

错误:无法成功处理命令“##[add-path]/opt/hostedtoolcache/aws/0.0.0/x64”。 错误:add-path 命令被禁用。请升级到使用环境文件或通过将 ACTIONS_ALLOW_UNSECURE_COMMANDS 环境变量设置为 true 选择不安全的命令执行。有关详细信息,请参阅:https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

这是我的 container.yml 文件

name: deploy-container

on:
  push:
    branches:
      - master
      - develop
    paths:
      - "packages/container/**"

defaults:
  run:
    working-directory: packages/container

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - run: npm install
      - run: npm run build

      - uses: chrislennon/action-aws-cli@v1.1
      - run: aws s3 sync dist s3://${{ secrets.AWS_S3_BUCKET_NAME }}/container/latest
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

知道为什么会这样。提前致谢

我知道这是出自的教程,使用

  - name: ACTIONS_ALLOW_UNSECURE_COMMANDS
    run: echo 'ACTIONS_ALLOW_UNSECURE_COMMANDS=true' >> $GITHUB_ENV

之前

  - uses: chrislennon/action-aws-cli@v1.1

它应该可以工作。

职位: 建造: runs-on: ubuntu-latest

steps:
  - uses: actions/checkout@v2
  - run: npm install
  - run: npm run build
  
  - uses: aws-actions/configure-aws-credentials@v1
    with:
      aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
      aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      aws-region: us-east-1
  - run: aws s3 sync dist s3://${{ secrets.AWS_S3_BUCKET_NAME }}/container/latest