-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90bd12a
commit cf8e5bc
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Build/Deploy to AWS | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
pull_request: | ||
types: [closed] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Allow one concurrent deployment | ||
concurrency: | ||
group: 'aws' | ||
cancel-in-progress: true | ||
|
||
env: | ||
BASE_URL: '/' | ||
|
||
permissions: | ||
id-token: write # This is required for requesting the JWT | ||
contents: read | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Configure AWS credentials from Test account | ||
uses: aws-actions/configure-aws-credentials@v3 | ||
with: | ||
role-to-assume: arn:aws:iam::176038645705:role/github-action-role | ||
role-session-name: deploy-developer-site-infra-to-aws | ||
aws-region: us-east-1 | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- name: Check out repo | ||
uses: actions/checkout@v3 | ||
- name: setup SAM | ||
uses: aws-actions/setup-sam@v2 | ||
- name: set env vars | ||
run: | | ||
if [ "${{ github.ref }}" = "refs/heads/main" ]; then | ||
echo "STACK=developer-sailpoint-site" >> $GITHUB_ENV | ||
elif [[ ${{ github.ref }} == refs/pull/* ]]; then | ||
PR_NUMBER=$(echo ${{ github.ref }} | awk -F '/' '{print $3}') | ||
echo "STACK=developer-sailpoint-site-$PR_NUMBER" >> $GITHUB_ENV | ||
elif [ "${{ github.ref }}" = "refs/heads/stage" ]; then | ||
echo "STACK=developer-sailpoint-site-stage" >> $GITHUB_ENV | ||
fi | ||
- name: Get S3 bucket location and cloudfront url | ||
run: | | ||
export S3_BUCKET=$(aws cloudformation describe-stacks --stack-name $STACK --query "Stacks[0].Outputs[?OutputKey=='DeveloperSailpointWebS3BucketName'].OutputValue" --output text) | ||
echo "S3_BUCKET=$S3_BUCKET" >> $GITHUB_ENV | ||
export CLOUDFRONT_URL=$(aws cloudformation describe-stacks --stack-name $STACK --query "Stacks[0].Outputs[?OutputKey=='DeveloperSailpointCloudFrontDistributionDomainName'].OutputValue" --output text) | ||
echo "CLOUDFRONT_URL=$CLOUDFRONT_URL" >> $GITHUB_ENV | ||
- name: run SAM delete | ||
run: | | ||
aws s3 rm s3://$S3_BUCKET --recursive | ||
sam delete --stack-name $STACK --no-prompts |