Merge pull request #3 from damc-dev/revert-to-03b12b63 #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Agent to AWS | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| types: | |
| - closed | |
| jobs: | |
| setup: | |
| # Only run on push to main or when PR is merged to main | |
| if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true) | |
| runs-on: ubuntu-latest | |
| outputs: | |
| agents: ${{ steps.get-agents.outputs.agents }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Extract agent names from config | |
| id: get-agents | |
| run: | | |
| # Extract agent names from YAML using yq | |
| agents=$(yq eval '.agents | keys' .bedrock_agentcore.yaml -o=json -I=0) | |
| echo "agents=$agents" >> "$GITHUB_OUTPUT" | |
| echo "Found agents: $agents" | |
| deploy: | |
| needs: setup | |
| # Loads the secrets from the dev environment from the repository settings | |
| environment: dev | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| agent: ${{ fromJSON(needs.setup.outputs.agents) }} | |
| fail-fast: false | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Install dependencies | |
| run: | | |
| uv sync | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v5 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
| aws-region: us-east-1 | |
| - name: Deploy agent with agentcore | |
| run: | | |
| uv run agentcore launch --agent ${{ matrix.agent }} | |
| cat .bedrock_agentcore.yaml | |
| env: | |
| AWS_DEFAULT_REGION: us-east-1 | |
| - name: Upload agent configuration artifact | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bedrock-agentcore-config-${{ matrix.agent }}-${{ github.sha }} | |
| include-hidden-files: true | |
| path: .bedrock_agentcore.yaml | |
| retention-days: 90 | |
| - name: Deployment summary | |
| if: success() | |
| run: | | |
| echo "✅ Agent '${{ matrix.agent }}' deployed successfully to AWS" |