如何使用 github 操作部署到 aws 弹性 beantalk?

时间:2021-03-19 02:57:00

标签: amazon-web-services amazon-s3 amazon-elastic-beanstalk github-actions

我目前正在尝试通过 github 操作进行自动部署。以下是我当前的工作流程 yaml 文件:

name: Deploy AWS
on: [workflow_dispatch]

    
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    
    - name: 'Git: Checkout source code'
      uses: actions/checkout@v1

    - name: '.NET Core: Setup'
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '3.0.*'
    
    - name: '.NET Core: Get dependencies'
      run: dotnet restore
    
    - name: '.NET Core: Build'
      run: dotnet build --configuration Debug --no-restore

    - name: 'AWS: Timestamp action'
      uses: gerred/actions/current-time@master
      id: current-time
      
    - name: 'AWS: String replace action'
      uses: frabert/replace-string-action@master
      id: format-time
      with:
        pattern: '[:\.]+'
        string: "${{ steps.current-time.outputs.time }}"
        replace-with: '-'
        flags: 'g'

    - name: 'AWS: Generate build archive'
      run: (cd ./project.Api/bin/Debug/netcoreapp3.0 && zip -r "../../../../${{ steps.format-time.outputs.replaced }}.zip" . -x '*.git*')
    
    - name: 'AWS: Deploying build'
      uses: einaregilsson/beanstalk-deploy@v14
      with:
        aws_access_key: { my_access_key }
        aws_secret_key: { my_secret_key }            
        application_name: api_test
        environment_name: my-api-test
        version_label: "v${{ steps.format-time.outputs.replaced }}"
        region: ap-southeast-2
        deployment_package: "${{ steps.format-time.outputs.replaced }}.zip"
        
    - name: 'AWS: Deployment complete'
      run: echo Should be on EB now

当前的弹性 beanstalk 环境设置了负载平衡器 - 我认为这是部署失败导致的主要问题。当环境包含负载均衡器时,我一直无法找到有关如何部署到 aws elastic beanstalk 的解决方案。 enter image description here

enter image description here

0 个答案:

没有答案