Workflow file for this run
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
name: Upload build result to s3 bucket (production ver.) | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
DEFAULT_BUCKET_REGION: ${{ secrets.DEFAULT_BUCKET_REGION }} | |
S3_BUCKET: ${{ secrets.S3_BUCKET }} | |
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
submodules: true | |
token: ${{ secrets.READ_PRIVATE_SUBMODULE_TOKEN }} | |
- name: Waiting build using Docker Compose | |
run: | | |
docker compose -f docker-compose.prod.yml up -d | |
docker compose -f docker-compose.prod.yml logs -f | |
- name: Copy built files to ./dist | |
run: | | |
mkdir -p ./dist | |
cp -r ./app/dist/* ./dist/ | |
- name: Install AWS | |
run: | | |
sudo apt-get update | |
sudo apt-get install awscli | |
- name: Upload to S3 | |
run: | | |
aws s3 sync ./app/dist s3://$S3_BUCKET --region $DEFAULT_BUCKET_REGION --exclude "cdn/*" --exclude "fonts/*" | |
aws s3 cp --cache-control 'max-age=300, stale-if-error=86400' ./app/dist/index.html s3://$S3_BUCKET --region $DEFAULT_BUCKET_REGION |