Skip to content

landing-page-datalastix #27

landing-page-datalastix

landing-page-datalastix #27

name: Create S3 Static Site
on:
issues:
type:
-opened
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up AWS CLI
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Extract Bucket Name from Issue
run: |
export BUCKET_NAME=$(echo "${{ github.event.issue.title }}")
echo "Bucket name: $BUCKET_NAME"
echo "BUCKET_NAME=$BUCKET_NAME" >> $GITHUB_ENV
- name: Run Terraform
run: |
cd terraform
cd s3-bucket-static
terraform init
terraform apply -auto-approve -var="bucket_name=${{ env.BUCKET_NAME }}"
- name: Add comment
run: gh issue comment "$NUMBER" --repo "$REPO" --body "$BODY"
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NUMBER: ${{ github.event.issue.number }}
REPO: ${{ github.repository }}
BODY: >
The S3 bucket has been created successfully!