Skip to content

Merge pull request #32 from NASA-IMPACT/fix/valid-export-name #23

Merge pull request #32 from NASA-IMPACT/fix/valid-export-name

Merge pull request #32 from NASA-IMPACT/fix/valid-export-name #23

Workflow file for this run

name: CICD πŸš€
permissions:
id-token: write
contents: read
on:
push:
branches:
- main
- dev
jobs:
define-environment:
name: Set ✨ environment ✨ based on the branch 🌳
runs-on: ubuntu-latest
steps:
- name: Set the environment
id: define_environment
run: |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
echo "env_name=staging" >> $GITHUB_OUTPUT
echo "secret_name=veda-auth-staging-env" >> $GITHUB_OUTPUT
elif [ "${{ github.ref }}" = "refs/heads/dev" ]; then
echo "env_name=dev" >> $GITHUB_OUTPUT
echo "secret_name=veda-auth-dev-env" >> $GITHUB_OUTPUT
fi
- name: Print the environment
run: echo "The environment is ${{ steps.define_environment.outputs.env_name }}"
outputs:
env_name: ${{ steps.define_environment.outputs.env_name }}
secret_name: ${{ steps.define_environment.outputs.secret_name }}
deploy:
name: Deploy to ${{ needs.define-environment.outputs.env_name }} πŸš€
runs-on: ubuntu-latest
if: ${{ needs.define-environment.outputs.env_name }}
needs: [define-environment]
environment: ${{ needs.define-environment.outputs.env_name }}
concurrency: ${{ needs.define-environment.outputs.env_name }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Configure awscli
uses: aws-actions/configure-aws-credentials@v3
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Install CDK
run: npm install -g aws-cdk@2
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
- name: Install python dependencies
run: |
pip install -r requirements.txt
- name: Get environment configuration for target branch
run: |
./scripts/get-env.sh ${{ needs.define-environment.outputs.secret_name }}
- name: Deploy
run: |
echo $STAGE
cdk deploy --require-approval never --outputs-file ${HOME}/cdk-outputs.json