Deployment Workflow #39
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: Beta Deployment Workflow | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
beta-deployment: | |
if: >- | |
github.event.issue.pull_request && | |
contains(github.event.comment.body, 'Approve Beta Deployment') && | |
github.actor == 'divyaas' | |
name: Get approval for deployment | |
permissions: | |
id-token: write | |
contents: read | |
issues: read | |
pull-requests: read | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Node.js and AWS CDK | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- name: Install dependencies and build project | |
run: | | |
npm install | |
npm run build | |
- name: Install AWS CDK | |
run: npm install -g [email protected] | |
- name: Assume IAM Role | |
uses: aws-actions/[email protected] | |
with: | |
role-to-assume: ${{ secrets.DEPLOY_STACKS_ROLE }} | |
aws-region: us-east-1 | |
- name: Deploy | |
run: | | |
COMMAND_OUTPUT=$(npm run cdk diff -- OpenSearch-CI-Config-Dev -c useSsl=false -c serverAccessType=prefixList -c restrictServerAccessTo=${{secrets.PREFIX_LIST}}) | |
echo "$COMMAND_OUTPUT" | grep -q "Number of stacks with differences: 0" | |
if [ $? -eq 0 ]; then | |
echo "No stack changes involved" | |
else | |
npm run cdk deploy -- OpenSearch-CI-Config-Dev -c useSsl=false -c serverAccessType=prefixList -c restrictServerAccessTo=${{secrets.PREFIX_LIST}} | |
npm run cdk deploy -- OpenSearch-CI-Dev -c useSsl=false -c authType=github -c dataRetention=true -c macAgent=true -c useProdAgents=true -c enableViews=true -c ignoreResourcesFailures=false -c serverAccessType=prefixList -c restrictServerAccessTo=${{secrets.PREFIX_LIST}} | |
fi |