feat: added time machine E2 in prod #116
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: Deploy to S3 | |
on: | |
push: | |
branches: | |
- main # Set a branch to deploy | |
pull_request: | |
jobs: | |
deploy: | |
runs-on: ubuntu-22.04 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true # Fetch Hugo themes (true OR recursive) | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- name: Hugo setup | |
uses: peaceiris/[email protected] | |
# extended: true | |
- name: Replace Placeholder | |
env: | |
TRACKING_ID: ${{ secrets.TRACKING_ID }} | |
run: | | |
sed -i "s/TRACKING_ID/$TRACKING_ID/g" config.yml | |
- name: check output | |
run: | | |
cat config.yml | |
- name: Build | |
run: hugo --minify | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-1 | |
- name: Deploy | |
run: aws s3 sync ./public s3://${{ secrets.BUCKET_NAME }} | |
- name: Invalidate CloudFront | |
uses: chetan/invalidate-cloudfront-action@v2 | |
env: | |
DISTRIBUTION: ${{ secrets.DISTRIBUTION }} | |
PATHS: "/*" | |
AWS_REGION: "us-west-1" | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |