Skip to content

Fix jekyll-tabs rendering in the estela docs #41

Fix jekyll-tabs rendering in the estela docs

Fix jekyll-tabs rendering in the estela docs #41

Workflow file for this run

name: Build and Deploy Docs preview
on:
pull_request:
paths:
- docs/**
workflow_dispatch:
jobs:
build:
name: Build preview docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set-up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
working-directory: "./docs/"
- name: Install redoc-cli
run: |
yarn global add [email protected]
echo "$(yarn global bin)" >> $GITHUB_PATH
- name: Build Swagger Documentation
run: redoc-cli build ./estela-api/docs/api.yaml -t ./docs/assets/swagger-template.hbs --options.hideDownloadButton -o ./docs/estela/api/endpoints.html
- name: Build Site
run: |
cd ./docs
bundle exec jekyll build
env:
JEKYLL_ENV: production
- 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: ${{ secrets.AWS_DEFAULT_REGION }}
- name: Set Environment Variables
run: |
export _BUCKET_NAME=$(echo estela-docs-${{ github.head_ref }} | tr '[:upper:]' '[:lower:]')
echo "BUCKET_NAME=$_BUCKET_NAME" >> $GITHUB_ENV
echo "{
\"Version\": \"2012-10-17\",
\"Statement\": [
{
\"Sid\": \"PublicReadGetObject\",
\"Effect\": \"Allow\",
\"Principal\": \"*\",
\"Action\": \"s3:GetObject\",
\"Resource\": \"arn:aws:s3:::$_BUCKET_NAME/*\"
}
]
}" > bucket_policy.json
- name: Create New S3 Bucket
run: |
if ! aws s3api head-bucket --bucket $BUCKET_NAME 2>/dev/null; then \
aws s3 mb s3://$BUCKET_NAME; \
cd ./docs/_site/
aws s3 website s3://$BUCKET_NAME --index-document index.html; \
cd ../../
aws s3api put-public-access-block --bucket $BUCKET_NAME --public-access-block-configuration "BlockPublicAcls=false,IgnorePublicAcls=false,BlockPublicPolicy=false,RestrictPublicBuckets=false"; \
aws s3api put-bucket-policy --bucket $BUCKET_NAME --policy file://bucket_policy.json; \
fi
- name: Deploy to S3 Bucket
run: aws s3 sync ./docs/_site/ s3://$BUCKET_NAME/ --delete
- name: Comment Website Direction
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Docs preview
recreate: true
message: |
## Docs preview
New docs deployment: [`${{ github.sha }}`]!
Check out the docs preview [here](http://${{ env.BUCKET_NAME }}.s3-website-${{ secrets.AWS_DEFAULT_REGION }}.amazonaws.com/index.html) :point_left: