Deploy API to dev #1848
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Env - API | |
run-name: "Deploy API to ${{ inputs.environment }}" | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: choice | |
description: Environment to deploy | |
default: dev | |
options: | |
- dev | |
- perf | |
- staging | |
- prod | |
ref: | |
description: "Branch or Commit" | |
default: main | |
required: true | |
type: string | |
lambdaDeploy: | |
description: "Include Lambda in deployment?" | |
default: false | |
required: false | |
type: boolean | |
workflow_call: | |
inputs: | |
environment: | |
required: true | |
type: string | |
ref: | |
required: true | |
type: string | |
lambdaDeploy: | |
default: false | |
required: false | |
type: boolean | |
jobs: | |
setup-environment: | |
name: "setup-env-${{ inputs.environment }}" | |
runs-on: ubuntu-latest | |
outputs: | |
git-hash: ${{ steps.set-hash.outputs.commit-hash }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.ref }} | |
- name: Set Hash | |
id: set-hash | |
run: | | |
echo "commit-hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- name: Env Values | |
run: | | |
echo "The environment is ${{ inputs.environment }}" | |
echo "The branch/tag is ${{ inputs.ref }}" | |
echo "The commit hash is ${{ steps.set-hash.outputs.commit-hash }}" | |
build-push-artifacts: | |
needs: [setup-environment] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.ref }} | |
- name: Configure VAEC AWS Credentials | |
uses: aws-actions/[email protected] | |
with: | |
aws-access-key-id: ${{ secrets.VAEC_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.VAEC_AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-gov-west-1 | |
role-to-assume: ${{ secrets.VAEC_DEPLOY_ROLE }} | |
role-skip-session-tagging: true | |
role-duration-seconds: 900 | |
- name: Build and Push Artifacts | |
uses: ./.github/actions/build-push-artifacts | |
with: | |
ref: "${{ needs.setup-environment.outputs.git-hash }}" | |
aws-access-key-id: ${{ secrets.VAEC_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.VAEC_AWS_SECRET_ACCESS_KEY }} | |
role-to-assume: ${{ secrets.VAEC_DEPLOY_ROLE }} | |
- name: Upload Env File to S3 | |
shell: bash | |
run: | | |
aws s3 cp cd/application-deployment/${{ inputs.environment }}/${{ inputs.environment }}.env s3://vanotify-environment-variables-${{ inputs.environment }}/ | |
run-lambda-deploy: | |
if: ${{ inputs.lambdaDeploy }} | |
needs: [setup-environment] | |
uses: ./.github/workflows/lambda-functions.yml | |
with: | |
environment: "${{ inputs.environment }}" | |
ref: "${{ needs.setup-environment.outputs.git-hash }}" | |
lambdaName: "All" | |
secrets: inherit | |
run-deployment: | |
needs: [setup-environment, build-push-artifacts] | |
uses: ./.github/workflows/deployment.yml | |
with: | |
environment: "${{ inputs.environment }}" | |
ref: "${{ needs.setup-environment.outputs.git-hash }}" | |
secrets: inherit | |
run-qa-suite: | |
needs: [run-deployment] | |
uses: ./.github/workflows/run-regression.yml | |
with: | |
environment: "${{ inputs.environment }}" | |
secrets: inherit | |