Skip to content

Deploy of stage to STAGE #1490

Deploy of stage to STAGE

Deploy of stage to STAGE #1490

Workflow file for this run

name: Docs deploy
run-name: Deploy of ${{ github.ref_name }} to ${{github.event.inputs.environment}}
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Target
required: true
options:
- STAGE # www-stage.ankr.com/docs/
- BS1 # bs-1-stage.dccn.ankr.com/docs/
- BS2 # bs-2-stage.dccn.ankr.com/docs/
- BS3 # bs-3-stage.dccn.ankr.com/docs/
- BS4 # bs-4-stage.dccn.ankr.com/docs/
- PROD # www.ankr.com/docs/
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: nelonoel/[email protected]
- name: Prevent wrong version releasing
if: ${{ github.event.inputs.environment == 'PROD' && github.ref != 'refs/heads/main' }}
run: |
echo "Production deployment is possible only from the main branch"
exit 1
- name: Get deployment information
run: |
echo "Branch: ${BRANCH_NAME}"
echo "Domain: ${{github.event.inputs.environment}}"
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: '18.19.0'
- name: Build
working-directory: .
run: |
yarn install
yarn build
- uses: actions/checkout@v3
with:
ref: main
repository: Ankr-network/staking-frontend
token: ${{ secrets.ACCESS_TOKEN }}
path: staking-frontend
- name: Install dependencies and build doc sdk
run: |
yarn install --cwd staking-frontend/packages/staking-sdk
cd staking-frontend/packages/staking-sdk
yarn docs
- name: Copy build
run: |
cd out/staking-for-developers/sdk/
mkdir liquid-staking
cd liquid-staking
mkdir reference
cd ../../../../
mv staking-frontend/packages/staking-sdk/docs/* out/staking-for-developers/sdk/liquid-staking/reference
- name: Set 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: ${{ secrets.AWS_REGION }}
- name: Copy files to the production website with the AWS CLI
working-directory: .
env:
DOMAIN: ${{ vars[format('{0}{1}', github.event.inputs.environment, '_DOMAIN')] }}
DISTRIBUTION_ID: ${{ vars[format('{0}{1}', github.event.inputs.environment, '_DISTRIBUTION_ID')] }}
run: |
aws s3 sync --delete ./out s3://$DOMAIN/docs/ --acl public-read --cache-control "public,max-age=600,s-maxage=3600"
aws configure set preview.cloudfront true
echo "Invalidating CDN network"
INVALIDATION_ID=`aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths '/*' | jq -r '.Invalidation.Id'`
echo "Invalidation ID is $INVALIDATION_ID"
echo "CDN Invalidation request is sent."
- name: Set redirections
working-directory: .
env:
DOMAIN: ${{ vars[format('{0}{1}', github.event.inputs.environment, '_DOMAIN')] }}
run: |
node redirects.js