Skip to content
Open
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
25 changes: 19 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,15 @@ on:
aws-secret-key:
description: "The AWS secret access key"
required: true
function-admin-api-key-staging:
description: "The API key for the Lambda Feedback staging backend function admin API"
required: false
function-admin-api-key-production:
description: "The API key for the Lambda Feedback production backend function admin API"
required: false
function-admin-api-key:
description: "The API key for the Lambda Feedback backend function admin API"
required: true
description: "Deprecated: shared admin API key, used as a fallback when the staging/production keys are not set"
required: false
build-secrets:
description: "The Docker secrets to use for the build"
required: false
Expand Down Expand Up @@ -133,10 +139,17 @@ jobs:
echo "Error: aws-secret-key secret is required"
exit 1
fi
if [[ -z "${{ secrets.function-admin-api-key }}" ]]; then
echo "Error: function-admin-api-key secret is required"
if [[ -z "${{ secrets.function-admin-api-key-staging || secrets.function-admin-api-key }}" ]]; then
echo "Error: function-admin-api-key-staging secret is required"
exit 1
fi
if [[ "${{ inputs.environment }}" == "production" && -z "${{ secrets.function-admin-api-key-production || secrets.function-admin-api-key }}" ]]; then
echo "Error: function-admin-api-key-production secret is required when deploying to production"
exit 1
fi
if [[ -n "${{ secrets.function-admin-api-key }}" ]]; then
echo "::warning::function-admin-api-key is deprecated, pass function-admin-api-key-staging and function-admin-api-key-production instead"
fi

deploy-staging:
if: inputs.environment == 'staging' || inputs.environment == 'production'
Expand All @@ -155,7 +168,7 @@ jobs:
secrets:
aws-key-id: ${{ secrets.aws-key-id }}
aws-secret-key: ${{ secrets.aws-secret-key }}
function-admin-api-key: ${{ secrets.function-admin-api-key }}
function-admin-api-key-staging: ${{ secrets.function-admin-api-key-staging || secrets.function-admin-api-key }}
build-secrets: ${{ secrets.build-secrets }}

await-approval:
Expand Down Expand Up @@ -194,5 +207,5 @@ jobs:
secrets:
aws-key-id: ${{ secrets.aws-key-id }}
aws-secret-key: ${{ secrets.aws-secret-key }}
function-admin-api-key: ${{ secrets.function-admin-api-key }}
function-admin-api-key-production: ${{ secrets.function-admin-api-key-production || secrets.function-admin-api-key }}
build-secrets: ${{ secrets.build-secrets }}
8 changes: 4 additions & 4 deletions .github/workflows/production_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ on:
aws-secret-key:
description: "The AWS secret access key"
required: true
function-admin-api-key:
description: "The API key for the Lambda Feedback backend function admin API"
required: true
function-admin-api-key-production:
description: "The API key for the Lambda Feedback production backend function admin API"
required: false
build-secrets:
description: "The Docker secrets to use for the build"
required: false
Expand Down Expand Up @@ -242,4 +242,4 @@ jobs:
secrets:
aws-key-id: ${{ secrets.aws-key-id }}
aws-secret-key: ${{ secrets.aws-secret-key }}
function-admin-api-key: ${{ secrets.function-admin-api-key }}
function-admin-api-key: ${{ secrets.function-admin-api-key-production }}
8 changes: 4 additions & 4 deletions .github/workflows/staging_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ on:
aws-secret-key:
description: "The AWS secret access key"
required: true
function-admin-api-key:
description: "The API key for the Lambda Feedback backend function admin API"
required: true
function-admin-api-key-staging:
description: "The API key for the Lambda Feedback staging backend function admin API"
required: false
build-secrets:
description: "The Docker secrets to use for the build"
required: false
Expand Down Expand Up @@ -91,4 +91,4 @@ jobs:
secrets:
aws-key-id: ${{ secrets.aws-key-id }}
aws-secret-key: ${{ secrets.aws-secret-key }}
function-admin-api-key: ${{ secrets.function-admin-api-key }}
function-admin-api-key: ${{ secrets.function-admin-api-key-staging }}