Skip to content

optimize deployment #134

optimize deployment

optimize deployment #134

Workflow file for this run

name: how.wtf CI
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Shallow clone with only the last 1 commit
- uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.GH_TOKEN }}
fetch-depth: 1
# - uses: actions/checkout@v2
# with:
# submodules: true
# token: ${{ secrets.GH_TOKEN }}
- uses: hashicorp/setup-terraform@v1
with:
terraform_wrapper: false
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
# Cache dependencies
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
/var/cache/apt
/var/lib/apt
key: ${{ runner.os }}-apt-${{ hashFiles('**/main.yml') }}
restore-keys: |
${{ runner.os }}-apt-
# Install dependencies
- name: Install dependencies
run: |
sudo apt-get update -y && sudo apt install -y \
libimage-exiftool-perl \
jpegoptim \
optipng \
graphicsmagick-imagemagick-compat
# Set up Hugo with fast render
- uses: peaceiris/actions-hugo@v2
with:
extended: true
args: --fastRender
# Deploy global infrastructure
- name: Deploy global infrastructure
# if: steps.check_changes.outputs.has_changes == 'true'
run: ENV=global make deploy
# Deploy website infrastructure with Terraform
- name: Deploy website infrastructure
# if: steps.check_changes.outputs.has_changes == 'true'
run: ENV=prod make deploy
# Sync website files to S3
- name: Sync website files to S3
# if: steps.check_changes.outputs.has_changes == 'true'
run: aws s3 sync ./public s3://yopa.page --delete