Skip to content

DEV-2459: Review and Improvements #180

DEV-2459: Review and Improvements

DEV-2459: Review and Improvements #180

name: "🚀 Staging Preview"
on:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- 'staging'
env:
AWS_REGION: us-east-2
IAM_ROLE_ARN: arn:aws:iam::675539733138:role/cplive-plat-ue2-staging-cloudposse-docs-gha
IAM_ROLE_SESSION_NAME: cloudposse-docs-ci-deploy-pr-${{ github.event.pull_request.number }}
S3_BUCKET_NAME: cplive-plat-ue2-staging-cloudposse-docs-origin
PR_NUMBER: ${{ github.event.pull_request.number }}
DEPLOYMENT_HOST: pr-${{ github.event.pull_request.number }}.cloudposse-docs.ue2.staging.plat.cloudposse.org
ALGOLIA_INDEX_NAME: docs-preview.cloudposse.com
ALGOLIA_APP_ID: 32YOERUX83
# These permissions are needed to interact with the GitHub's OIDC Token endpoint
permissions:
id-token: write
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: preview
url: https://${{ env.DEPLOYMENT_HOST }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build Website
uses: ./.github/actions/build-website
with:
aws_region: ${{ env.AWS_REGION }}
iam_role_arn: ${{ env.IAM_ROLE_ARN }}
iam_role_session_name: ${{ env.IAM_ROLE_SESSION_NAME }}
repo_access_token: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Copy Website to S3 Bucket PR Folder
run: |
cd build
aws sts get-caller-identity
aws s3 sync . s3://${{ env.S3_BUCKET_NAME }}/pr-${{ env.PR_NUMBER }}/ --delete
aws s3 ls s3://${{ env.S3_BUCKET_NAME }}/pr-${{ env.PR_NUMBER }}/ --recursive --human-readable --summarize
- name: ReIndex with Algolia
if: ${{ contains(github.event.*.labels.*.name, 'reindex') }}
env:
ALGOLIA_SCRAPER_API_KEY: ${{ secrets.ALGOLIA_SCRAPER_API_KEY }}
run: |
./algolia/reindex.sh