Skip to content

Commit

Permalink
Update s3.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
yongenaelf authored Sep 4, 2024
1 parent 6377398 commit e05b78d
Showing 1 changed file with 10 additions and 40 deletions.
50 changes: 10 additions & 40 deletions .github/workflows/s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,13 @@ jobs:
echo TYPESENSE_SERVER_HOST=${{ vars.TYPESENSE_SERVER_HOST }} >> .env
echo TYPESENSE_SEARCH_ONLY_APIKEY=${{ vars.TYPESENSE_SEARCH_ONLY_APIKEY }} >> .env
- run: npm run build
- name: Deploy
env:
AWS_DEFAULT_REGION: "ap-northeast-1"
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
if [ -z "$AWS_S3_BUCKET" ]; then
echo "AWS_S3_BUCKET is not set. Quitting."
exit 1
fi
if [ -z "$AWS_ACCESS_KEY_ID" ]; then
echo "AWS_ACCESS_KEY_ID is not set. Quitting."
exit 1
fi
if [ -z "$AWS_SECRET_ACCESS_KEY" ]; then
echo "AWS_SECRET_ACCESS_KEY is not set. Quitting."
exit 1
fi
if [ -z "$AWS_DEFAULT_REGION" ]; then
echo "AWS_DEFAULT_REGION is not set. Quitting."
exit 1
fi
mkdir -p ~/.aws
touch ~/.aws/credentials
echo "[default]
aws_access_key_id = ${AWS_ACCESS_KEY_ID}
aws_secret_access_key = ${AWS_SECRET_ACCESS_KEY}" > ~/.aws/credentials
echo "Copying to website folder"
aws s3 sync ./build s3://${AWS_S3_BUCKET} --exact-timestamps --delete --region ${AWS_DEFAULT_REGION} $*
echo "Cleaning up things"
rm -rf ~/.aws

- name: Configure AWS Credentials
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: ap-northeast-1

- name: Sync to S3
run: aws s3 sync ./build s3://${{ secrets.AWS_S3_BUCKET }}

0 comments on commit e05b78d

Please sign in to comment.