-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (60 loc) · 2.05 KB
/
Copy pathdeploy-prod.yml
File metadata and controls
70 lines (60 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Deploy to production
on:
push:
branches: [main]
paths:
- "agents/**"
- "prompts/**"
permissions:
id-token: write
contents: write
jobs:
deploy:
name: Deploy versioned agent to production
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install dependencies
run: pip install -r requirements.txt
- name: Azure login (OIDC federation)
uses: azure/login@v2
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
- name: Derive semver from Git tags
id: version
run: |
SEMVER=$(git describe --tags --abbrev=0 2>/dev/null || echo "1.0.$(git rev-list --count HEAD)")
echo "semver=${SEMVER#v}" >> $GITHUB_OUTPUT
- name: Deploy agent to PRODUCTION
env:
FOUNDRY_PROD_ENDPOINT: ${{ vars.FOUNDRY_PROD_ENDPOINT }}
GPT_DEPLOYMENT: ${{ vars.GPT_DEPLOYMENT }}
BING_CONNECTION_NAME: ${{ vars.BING_CONNECTION_NAME }}
run: |
TOOLS=$(python3 -c "
import json
cfg = json.load(open('agents/tech-trends-agent.json'))
print(','.join(t['type'] for t in cfg['definition']['tools']))
")
python scripts/deploy_agent.py \
--env prod \
--semver "${{ steps.version.outputs.semver }}" \
--tools "$TOOLS"
- name: Commit artifact to repository
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add artifacts/
git diff --staged --quiet || git commit -m \
"chore: add agent artifact v${{ steps.version.outputs.semver }} [skip ci]"
git push