Skip to content

Deploy Automator

Deploy Automator #7

name: Deploy Automator
on:
workflow_run:
workflows: ["Test Automator"]
types:
- completed
workflow_dispatch:
env:
AWS_REGION: eu-west-1
FUNCTION_NAME: automator-process-reaction
DEPLOY_ROLE_ARN: arn:aws:iam::387546586013:role/automator-lambda-deploy
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write # request the OIDC token for AWS role assumption
contents: read
# Deploy only when Test Automator passed on main, or when manually run from main.
if: (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
defaults:
run:
working-directory: automator
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: '3.12'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ env.DEPLOY_ROLE_ARN }}
aws-region: ${{ env.AWS_REGION }}
- name: Package Lambda function
run: bash scripts/package.sh
- name: Deploy to AWS Lambda
run: bash scripts/deploy.sh
- name: Verify deployment
run: |
aws lambda get-function \
--function-name "$FUNCTION_NAME" \
--region "$AWS_REGION" \
--query 'Configuration.LastModified' \
--output text
echo "Automator Lambda function updated successfully"