Skip to content

tutorials.groupdocs.com(tutorials-viewer)(family)(Production) #49

tutorials.groupdocs.com(tutorials-viewer)(family)(Production)

tutorials.groupdocs.com(tutorials-viewer)(family)(Production) #49

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: tutorials.groupdocs.com(tutorials-viewer)(family)(Production)
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
paths:
- 'content/**'
pull_request:
branches: [ master ]
paths:
- 'content/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of viewer that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true # Fetch Hugo themes
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Checkout theme repo
uses: actions/checkout@main
with:
repository: groupdocs/tutorials-theme
token: ${{ secrets.REPO_TOKEN }}
fetch-depth: 0
path: themes/tutorials-theme
- name: Install Theme Dependencies
run: npm install
working-directory: ./themes/tutorials-theme
# Step 2 - Sets up the latest version of Hugo
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: 'latest'
extended: true
- name: Install Dependicies1
run: npm install -D --save autoprefixer
- name: Install Dependicies2
run: npm install -D --save postcss-cli
- name: Install Dependicies3
run: npm install -D postcss
# Also specifies the theme we want to use
- name: Build
run: hugo --configDir config/viewer --environment production --minify
# Configure AWS credentials
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.SECRET_ACCESS }}
aws-region: us-west-2
- name: Deploy to S3 using AWS CLI
run: |
aws s3 sync public/ s3://${{ secrets.S3_BUCKET }}/viewer/ \
--delete \
--exclude "*.map" \
--cache-control "public, max-age=3600"
# Invalidate Cloudfront
- name: invalidate
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION_PROD }}
PATHS: /viewer/*
AWS_REGION: 'us-west-2'
AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }}