Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/deploy-api-lambda-edge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Deploy API Lambda (edge)"

on:
push:
branches:
- main

permissions:
contents: read

jobs:
deploy:
uses: ./.github/workflows/deploy-api-lambda.yml
with:
environment: edge
19 changes: 19 additions & 0 deletions .github/workflows/deploy-api-lambda-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Deploy API Lambda (prod)"

on:
workflow_dispatch:
inputs:
ref:
description: 'The git tag of the release to deploy, e.g. 3.0.0'
required: true
type: string

permissions:
contents: read

jobs:
deploy:
uses: ./.github/workflows/deploy-api-lambda.yml
with:
environment: prod
ref: refs/tags/${{ github.event.inputs.ref }}
16 changes: 16 additions & 0 deletions .github/workflows/deploy-api-lambda-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Deploy API Lambda (staging)"

on:
release:
types:
- published

permissions:
contents: read

jobs:
deploy:
uses: ./.github/workflows/deploy-api-lambda.yml
with:
environment: staging
ref: refs/tags/${{ github.event.release.tag_name }}
33 changes: 20 additions & 13 deletions .github/workflows/deploy-api-lambda.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
name: Deploy API Lambda

on:
push:
branches:
- main
workflow_dispatch:
workflow_call:
inputs:
environment:
required: true
type: string
description: edge, staging or prod
ref:
required: false
type: string
default: ${{ github.ref }}

permissions:
contents: read
Expand All @@ -13,23 +20,21 @@ jobs:
permissions:
contents: read
uses: ./.github/workflows/build-api-lambda.yml

with:
ref: ${{ inputs.ref }}

deploy:
concurrency: ${{ github.workflow }}
concurrency: ${{ github.workflow }}-${{ inputs.environment }}
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
needs: build
environment: docs-api-edge
environment: docs-api-${{ inputs.environment }}
env:
ZIP_FILE: api-lambda.zip
steps:
- uses: actions/checkout@v5
- name: Download bootstrap binary
uses: actions/download-artifact@v4
with:
name: api-lambda-binary

- name: Download bootstrap binary
uses: actions/download-artifact@v4
Expand All @@ -42,11 +47,13 @@ jobs:

- uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
with:
role-to-assume: arn:aws:iam::197730964718:role/elastic-docs-v3-api-deployer-edge
role-to-assume: arn:aws:iam::197730964718:role/elastic-docs-v3-api-deployer-${{ inputs.environment }}
aws-region: us-east-1

- name: Upload Lambda function
run: |
aws lambda update-function-code \
--function-name elastic-docs-v3-edge-api \
--function-name "elastic-docs-v3-${ENVIRONMENT}-api" \
--zip-file "fileb://${ZIP_FILE}"
env:
ENVIRONMENT: ${{ inputs.environment }}
Loading