MDCT-2765 Pt. I: Add New Data Source Type Validation (#1903) #8655
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 | |
on: | |
push: | |
branches: | |
- "*" | |
- "dependabot/**" | |
- "!skipci*" | |
permissions: | |
id-token: write | |
contents: read | |
actions: read | |
jobs: | |
unit-tests: | |
name: Unit Tests | |
uses: ./.github/workflows/unittest-workflow.yml | |
if: github.ref == 'refs/heads/master' | |
secrets: | |
CODE_CLIMATE_ID: ${{ secrets.CODE_CLIMATE_ID }} | |
deploy: | |
runs-on: ubuntu-latest | |
env: | |
SLS_DEPRECATION_DISABLE: "*" # Turn off deprecation warnings in the pipeline | |
steps: | |
- name: set branch_name | |
run: | | |
if [[ "$GITHUB_REF" =~ ^refs/heads/dependabot/.* ]]; then # Dependabot builds very long branch names. This is a switch to make it shorter. | |
echo "branch_name=`echo ${GITHUB_REF#refs/heads/} | md5sum | head -c 10 | sed 's/^/x/'`" >> $GITHUB_ENV | |
else | |
echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
fi | |
- uses: actions/checkout@v3 | |
- name: Validate branch name | |
run: ./.github/branchNameValidation.sh $STAGE_PREFIX$branch_name | |
- name: set branch specific variable names | |
run: ./.github/build_vars.sh set_names | |
- name: set variable values | |
run: ./.github/build_vars.sh set_values | |
env: | |
AWS_DEFAULT_REGION: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_DEFAULT_REGION] || secrets.AWS_DEFAULT_REGION }} | |
AWS_OIDC_ROLE_TO_ASSUME: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_OIDC_ROLE_TO_ASSUME] || secrets.AWS_OIDC_ROLE_TO_ASSUME }} | |
STAGE_PREFIX: ${{ secrets.STAGE_PREFIX }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
CODE_CLIMATE_ID: ${{ secrets.CODE_CLIMATE_ID }} | |
- name: lock this branch to prevent concurrent builds | |
run: ./.github/github-lock.sh $branch_name | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Configure AWS credentials for GitHub Actions | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }} | |
aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
- name: read .nvmrc | |
id: node_version | |
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ steps.node_version.outputs.NODE_VERSION }} | |
- uses: actions/cache@v2 | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock', 'plugins/**') }} | |
- name: set path | |
run: | | |
echo "PATH=$(pwd)/node_modules/.bin/:$PATH" >> $GITHUB_ENV | |
- name: deploy | |
run: | | |
# When deploying multiple copies of this quickstart to the same AWS Account (not ideal), a prefix helps prevent stepping on each other. | |
# This can optionally be set as an GitHub Actions Secret | |
./deploy.sh $STAGE_PREFIX$branch_name |