Skip to content

Commit 85607e1

Browse files
authored
Add API lambda deploy workflows for all stages (#1828)
* Add API lambda deploy workflows for all stages * Update .github/workflows/deploy-api-lambda-staging.yml
1 parent 25d8f13 commit 85607e1

File tree

4 files changed

+70
-13
lines changed

4 files changed

+70
-13
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "Deploy API Lambda (edge)"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
deploy:
13+
uses: ./.github/workflows/deploy-api-lambda.yml
14+
with:
15+
environment: edge
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "Deploy API Lambda (prod)"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: 'The git tag of the release to deploy, e.g. 3.0.0'
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
deploy:
16+
uses: ./.github/workflows/deploy-api-lambda.yml
17+
with:
18+
environment: prod
19+
ref: refs/tags/${{ github.event.inputs.ref }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: "Deploy API Lambda (staging)"
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
deploy:
13+
uses: ./.github/workflows/deploy-api-lambda.yml
14+
with:
15+
environment: staging
16+
ref: refs/tags/${{ github.event.release.tag_name }}
Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
name: Deploy API Lambda
2+
23
on:
3-
push:
4-
branches:
5-
- main
6-
workflow_dispatch:
4+
workflow_call:
5+
inputs:
6+
environment:
7+
required: true
8+
type: string
9+
description: edge, staging or prod
10+
ref:
11+
required: false
12+
type: string
13+
default: ${{ github.ref }}
714

815
permissions:
916
contents: read
@@ -13,23 +20,21 @@ jobs:
1320
permissions:
1421
contents: read
1522
uses: ./.github/workflows/build-api-lambda.yml
16-
23+
with:
24+
ref: ${{ inputs.ref }}
25+
1726
deploy:
18-
concurrency: ${{ github.workflow }}
27+
concurrency: ${{ github.workflow }}-${{ inputs.environment }}
1928
permissions:
2029
contents: read
2130
id-token: write
2231
runs-on: ubuntu-latest
2332
needs: build
24-
environment: docs-api-edge
33+
environment: docs-api-${{ inputs.environment }}
2534
env:
2635
ZIP_FILE: api-lambda.zip
2736
steps:
2837
- uses: actions/checkout@v5
29-
- name: Download bootstrap binary
30-
uses: actions/download-artifact@v4
31-
with:
32-
name: api-lambda-binary
3338

3439
- name: Download bootstrap binary
3540
uses: actions/download-artifact@v4
@@ -42,11 +47,13 @@ jobs:
4247
4348
- uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
4449
with:
45-
role-to-assume: arn:aws:iam::197730964718:role/elastic-docs-v3-api-deployer-edge
50+
role-to-assume: arn:aws:iam::197730964718:role/elastic-docs-v3-api-deployer-${{ inputs.environment }}
4651
aws-region: us-east-1
4752

4853
- name: Upload Lambda function
4954
run: |
5055
aws lambda update-function-code \
51-
--function-name elastic-docs-v3-edge-api \
56+
--function-name "elastic-docs-v3-${ENVIRONMENT}-api" \
5257
--zip-file "fileb://${ZIP_FILE}"
58+
env:
59+
ENVIRONMENT: ${{ inputs.environment }}

0 commit comments

Comments
 (0)