From 36ed080ef74002c5e9ddde0ce185742530073442 Mon Sep 17 00:00:00 2001 From: Salar Rahmanian Date: Fri, 24 Jul 2020 23:19:45 -0700 Subject: [PATCH] Workflow updates --- .github/workflows/build.yml | 40 ++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58e8236..3e6a88c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,26 +1,34 @@ name: Build and Deploy -on: push +on: + push: + branches: + - master jobs: build: name: Build and Deploy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Install Hugo - run: | - HUGO_DOWNLOAD=hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz - wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${HUGO_DOWNLOAD} - tar xvzf ${HUGO_DOWNLOAD} hugo - mv hugo $HOME/hugo - env: - HUGO_VERSION: 0.72.0 + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: '0.72.0' + extended: true + + - name: Configure AWS Credentials + 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 + - name: Hugo Build - run: $HOME/hugo -v + run: hugo --minify + - name: Deploy to S3 - if: github.ref == 'refs/heads/master' - run: $HOME/hugo -v deploy --maxDeletes -1 - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + run: hugo deploy --maxDeletes -1 --invalidateCDN