Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OSDEV-899] Move React application to the S3 bucket #449

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/deploy_to_aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,29 @@ jobs:
working-directory: src/react
run: yarn run build

- id: project
uses: Entepotenz/change-string-case-action-min-dependencies@v1
with:
string: ${{ vars.PROJECT }}

- name: Move static
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
FRONTEND_BUCKET: ${{ steps.project.outputs.lowercase }}-${{ steps.get_env_name.outputs.lowercase }}-frontend
AWS_DEFAULT_REGION: "eu-west-1"
CLOUDFRONT_DOMAIN: ${{ vars.CLOUDFRONT_DOMAIN }}
run: |
for id in $(aws cloudfront list-distributions --query "DistributionList.Items[*].Id" --output text); do
domains=$(aws cloudfront get-distribution-config --id $id --query "DistributionConfig.Aliases.Items" --output text)
if [[ "$domains" == "$CLOUDFRONT_DOMAIN" ]]; then
echo "Found Distribution ID: $id for Domain: $CLOUDFRONT_DOMAIN"
CLOUDFRONT_DISTRIBUTION_ID=$id
fi
done
aws s3 sync src/react/build/ s3://$FRONTEND_BUCKET-$AWS_DEFAULT_REGION/ --delete --acl public-read
aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"

roninzp marked this conversation as resolved.
Show resolved Hide resolved
- name: Move static
run: mv src/react/build src/django/static

Expand Down
Loading
Loading