Skip to content

Merge pull request #64 from Orfium/fix/DVP-125-adblockers #89

Merge pull request #64 from Orfium/fix/DVP-125-adblockers

Merge pull request #64 from Orfium/fix/DVP-125-adblockers #89

Workflow file for this run

name: CI
on:
push:
branches:
- 'master'
- 'next'
- 'v3.x'
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
env:
PRODUCT: toolbox
CI: false
NODE_ENV: staging
REACT_APP_STAGE: staging
environment:
name: toolbox
url: https://toolbox.dev.orfium.xyz
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: '18.13.0'
- name: Install dependencies and build app
run: |
yarn
yarn documentation:build
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.DEV_CD_USER_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DEV_CD_USER_AWS_SECRET_ACCESS_KEY }}
aws-region: "us-east-1"
- name: Check deployment existence
# if: (github.ref == 'refs/heads/master')
id: check-stack-existence
run: |
if aws cloudformation describe-stacks --stack-name ${{ env.PRODUCT }}; then
echo "::set-output name=stack_exists::1";
else
echo "::set-output name=stack_exists::0";
fi
- name: Set up S3-Cloudfront
# if: (github.ref == 'refs/heads/master') && steps.check-stack-existence.outputs.stack_exists == '0'
if: steps.check-stack-existence.outputs.stack_exists == '0'
id: review-app-setup
uses: aws-actions/[email protected]
with:
name: "${{ env.PRODUCT }}"
role-arn: "arn:aws:iam::102867326982:role/OrfiumCloudFormationExecRole"
template: >-
https://orfium-cf-templates.s3.amazonaws.com/aws-cloudfront-s3-frontend.yml
parameter-overrides: >-
CSPHeaderValue=${{ env.CSP_HEADER }},
FeDomainName=${{ env.PRODUCT }}.dev.orfium.xyz,
CreateDNSRecord=true,
HostedZoneName=dev.orfium.xyz,
TLSCertificateArn=arn:aws:acm:us-east-1:102867326982:certificate/a944c841-aaa5-4612-b58c-a27630b335e5
no-fail-on-empty-changeset: "1"
tags: >
[
{"Key": "Name", "Value": "review-frontend"},
{"Key": "info:creator", "Value": "github-actions"},
{"Key": "info:maintainer", "Value": "devops.dpt"},
{"Key": "info:product", "Value": "${{ env.PRODUCT }}"},
{"Key": "info:env", "Value": "test"}
]
- name: Push to Production - invalidate cache
run: |
S3_BUCKET_NAME=$(aws cloudformation describe-stacks --stack-name "${{ env.PRODUCT }}" --query 'Stacks[0].Outputs[?OutputKey==`S3BucketName`].OutputValue' --output text)
DISTRIBUTION_ID=$(aws cloudformation describe-stacks --stack-name "${{ env.PRODUCT }}" --query 'Stacks[0].Outputs[?OutputKey==`FeCloudFrontDistributionId`].OutputValue' --output text)
INVALIDATION_ID=`aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*" | jq -r .Invalidation.Id`
aws s3 sync documentation/build/ s3://${S3_BUCKET_NAME}/
aws cloudfront wait invalidation-completed --distribution-id $DISTRIBUTION_ID --id $INVALIDATION_ID
- name: Release
env:
GITHUB_NPM_CONFIG_REGISTRY: 'https://npm.pkg.github.com/'
GITHUB_NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLIC_NPM_CONFIG_REGISTRY: 'https://registry.npmjs.org'
PUBLIC_NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
deploy-docs:
if: github.ref == 'refs/heads/master'
name: Deploy Docs
runs-on: ubuntu-latest
needs: deploy
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: '18.13.0'
- name: Install dependencies
run: yarn install
- name: Generate docs
run: yarn documentation:generate
- name: Clone docs repo
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: Orfium/docs
path: docs-repo
ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }}
- name: Copy and commit docs
run: |
rm -rf $GITHUB_WORKSPACE/docs-repo/${GITHUB_REPOSITORY#*/}
mkdir -p $GITHUB_WORKSPACE/docs-repo/${GITHUB_REPOSITORY#*/}
cp -r typeDocs/* $GITHUB_WORKSPACE/docs-repo/${GITHUB_REPOSITORY#*/}/
cd $GITHUB_WORKSPACE/docs-repo/
git config --global user.email "[email protected]"
git config --global user.name "orfium-org"
git add .
git commit -m "Update ${GITHUB_REPOSITORY#*/} docs"
git push origin master