Skip to content

EKS Hybrid documentation improvements (4.6.0) (#5731) #620

EKS Hybrid documentation improvements (4.6.0) (#5731)

EKS Hybrid documentation improvements (4.6.0) (#5731) #620

# This workflow is triggered on push to any branch that starts with "release-". The primary purpose of this workflow is to create a preview of the upcoming release content and simulate the look and feel of the production site.
# The domain used for the preview is docs-latest.spectrocloud.com. The workflow builds the site and uploads the content to an S3 bucket. The S3 bucket is configured to serve the content as a static website.
# No update will occur in the event the build is unable to complete successfully. This is due to a scenario where an immediate failover from docs.specrocloud.com to docs-latest.spectrocloud.com is needed.
# The workflow also posts a comment to the PR with the Netlify preview URL.
name: Release Branch Preview
on:
push:
branches:
- "release-[0-9]-[0-9]"
- "release-[0-9]-[0-9]-[a-z]"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_S3_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_S3_SECRET_KEY }}
AWS_DEFAULT_REGION: us-east-1
APPZI_TOKEN: ${{ secrets.APPZI_TOKEN }}
FULLSTORY_ORGID: ${{ secrets.FULLSTORY_ORGID }}
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_SEARCH_KEY: ${{ secrets.ALGOLIA_SEARCH_KEY }}
ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME }}
PALETTE_API_KEY: ${{ secrets.PALETTE_API_KEY }}
DISABLE_PACKS_INTEGRATIONS: ${{ secrets.DISABLE_PACKS_INTEGRATIONS }}
DISABLE_SECURITY_INTEGRATIONS: ${{ secrets.DISABLE_SECURITY_INTEGRATIONS }}
SHOW_LAST_UPDATE_TIME: ${{ secrets.SHOW_LAST_UPDATE_TIME }}
DSO_AUTH_TOKEN: ${{ secrets.DSO_AUTH_TOKEN }}
UNRELEASED_VERSION_BANNER: true
concurrency:
group: preview-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- run: npm ci
- name: Make Robots.txt
run: |
touch static/robots.txt
echo "User-agent: *" >> static/robots.txt
echo "Disallow: /" >> static/robots.txt
echo "Sitemap: https://docs-latest.spectrocloud.com/sitemap.xml" >> static/robots.txt
- name: Ensure noIndex is set
id: check_noindex
run: node scripts/noindex_docusaurus_config.js $PWD
- name: Build
run: |
set +e # Disable automatic stop on command failure
touch .env
make build-ci
exit_code=$?
echo "Build command exit code: $exit_code"
echo "BUILD_EXIT_CODE=$exit_code">> $GITHUB_ENV
- name: Build with cached packs
if: ${{ env.BUILD_EXIT_CODE == '5' }}
uses: ./.github/actions/build-cached-packs
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build with cached CVEs
if: ${{ env.BUILD_EXIT_CODE == '7' }}
uses: ./.github/actions/build-cached-cves
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy Preview
if: ${{ env.BUILD_EXIT_CODE == '0' }}
run: |
aws s3 sync --cache-control 'public, max-age=604800' --exclude '*.html' --exclude build/scripts/ build/ s3://docs-latest.spectrocloud.com --delete
aws s3 sync --cache-control 'public, max-age=0, s-maxage=604800' build/ s3://docs-latest.spectrocloud.com --delete
aws cloudfront create-invalidation --distribution-id ${{ secrets.LATEST_DOCS_DISTRIBUTION_ID }} --paths "/*"
- name: Post Netlify URL
uses: mshick/add-pr-comment@v2
with:
message: |
🚀 docs-latest.spectrocloud.com preview deployed succesfully for commit ${{ github.sha }}. Click [here](https://docs-latest.spectrocloud.com) to preview the changes.
message-failure: |
👎 Uh oh! The Netlify Preview failed to deploy for commit ${{ github.sha }}. Please check the Netlify logs for more information.
refresh-message-position: true
update-only: false