Skip to content

BITMAKER-3606 Feature environments: Automatic workflow for deploying … #39

BITMAKER-3606 Feature environments: Automatic workflow for deploying …

BITMAKER-3606 Feature environments: Automatic workflow for deploying … #39

name: Build and Deploy the Docs
on:
push:
branches:
- main
paths:
- docs/**
workflow_dispatch:
jobs:
build_deploy:
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: Deploy to S3 Bucket
run: aws s3 sync ./docs/_site/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}/docs/ --delete
- name: Create Cloudfront Invalidation
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"