update docs #50
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
################################################ | |
# GITHUB ACTION WORKFLOW NAME | |
################################################ | |
name: Practera Docs Build and Deploy | |
################################################ | |
# GITHUB ACTION EVENT TRIGGER | |
################################################ | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- trunk | |
################################################ | |
# GITHUB ACTION JOBS | |
################################################ | |
jobs: | |
practera-docs: | |
name: practera-docs | |
runs-on: ubuntu-latest | |
################################################ | |
# GITHUB ACTIONS GLOBAL ENV VARIABLES | |
################################################ | |
env: | |
REGION : global | |
ENV : live # Valid values are dev,test,live onl | |
STACK_NAME: global-live # Valid values are global-stage,global-live only | |
ROOTSTACK: practera-docs | |
CFNS3BucketName: devops-cfn-templates | |
PRIVATES3BucketName: devops-shared-private | |
STATUSREPORTS3Bucket: deployment-status.practera.com | |
STATUS: DEPLOYED | |
ENDPOINT: https://intersective.github.io/docs/ | |
BRANCH_TAG_NAME: trunk | |
################################################ | |
# GITHUB REPO CHECKOUT | |
################################################ | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
################################################ | |
# NODE ENV | |
################################################ | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
################################################ | |
# NODE MODULES CACHE | |
################################################ | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
id: cache-node-modules | |
env: | |
cache-name: cache | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: | | |
~/.npm | |
node_modules | |
*/*/node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
################################################ | |
# NODE MODULES INSTALL | |
################################################ | |
- name: Install dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: npm install | |
################################################ | |
# BUILD PACKAGE | |
################################################ | |
- name: npm build packages | |
run: npm run build | |
################################################ | |
# AWS CLI CONFIGURATION - DEVOPS | |
################################################ | |
- name: Configure AWS credentials from $STACK_NAME account in $REGION region | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.DEVOPS_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.DEVOPS_AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-southeast-2 | |
################################################ | |
# DEPLOY GH PAGES | |
################################################ | |
- name: Deploy gh pages | |
uses: JamesIves/github-pages-deploy-action@4.1.4 | |
with: | |
branch: gh-pages # The branch the action should deploy to. | |
folder: src/.vuepress/dist # The folder the action should deploy. | |
# ########################################################## | |
# # SLACK NOTIFICATION | |
# ########################################################## | |
- name: Slack Notification | |
if: always() # Pick up events even if the job fails or is canceled. | |
uses: 8398a7/action-slack@v3 | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
MATRIX_CONTEXT: ${{ toJson(matrix) }} # required | |
with: | |
status: ${{ job.status }} | |
author_name: practera docs deployed | |
mention: 'here' | |
if_mention: failure,cancelled | |
job_name: practera-docs # Match the name above. | |
fields: repo,commit,eventName,ref,workflow,message,author,job,took | |
custom_payload: | | |
{ | |
username: 'GitHub Action CI WorkFlow', | |
icon_emoji: ':github:', | |
attachments: [{ | |
color: '${{ job.status }}' === 'success' ? 'good' : ${{ job.status }}' === 'failure' ? 'danger' : 'warning', | |
text: | |
`${process.env.AS_REPO}\n | |
${process.env.AS_COMMIT}\n | |
${process.env.AS_EVENT_NAME}\n | |
@${process.env.AS_REF}\n | |
@${process.env.AS_WORKFLOW}\n | |
${process.env.AS_MESSAGE}\n | |
${process.env.AS_AUTHOR}\n | |
${process.env.AS_JOB}\n | |
${process.env.AS_TOOK}`, | |
}] | |
} | |
# ################################################ | |
# # STATUS VARIABLE UPDATE | |
# ################################################ | |
- name: Deployment status variable update | |
if: ${{ failure() }} | |
run: | | |
echo "STATUS=FAILURE" >> $GITHUB_ENV | |
# ################################################ | |
# # DEVOPS-DEPLOYMENT REPORT | |
# ################################################ | |
- name: DevOps Deployment Reporting | |
if: always() | |
run: | | |
pip install --upgrade pip | |
pip install --upgrade csvtotable | |
aws s3 cp s3://$STATUSREPORTS3Bucket/deploy-reporting.sh deploy-reporting.sh | |
chmod +x deploy-reporting.sh && ./deploy-reporting.sh | |
echo "LINK="${GITHUB_REPOSITORY##*/}.html >> $GITHUB_ENV | |