add generic python package #12
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
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
deploy: | |
name: Upload to Amazon S3 | |
runs-on: ubuntu-latest | |
# These permissions are needed to interact with GitHub's OIDC Token endpoint. | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure AWS credentials from Production account | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} | |
aws-region: ${{ vars.AWS_REGION }} | |
- name: Pre deployment cleanup | |
run: | | |
sh scripts/predeploy.sh | |
- name: "DRY RUN: Copy files to the production website with the AWS CLI" | |
if: github.base_ref != 'refs/heads/main' | |
run: | | |
aws s3 sync . s3://repo.vineelsai.com --dryrun | |
- name: Copy files to the production website with the AWS CLI | |
if: github.base_ref == 'refs/heads/main' | |
run: | | |
aws s3 sync . s3://repo.vineelsai.com | |
- name: Invalidate CloudFront cache | |
if: github.base_ref == 'refs/heads/main' | |
run: | | |
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*" |