Skip to content

Commit

Permalink
created staging release pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
milldr committed Jun 7, 2024
1 parent 99b5225 commit e390e6e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/website-deploy-staging-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
GOOGLE_SITE_VERIFICATION_ID: ${{ env.GOOGLE_SITE_VERIFICATION_ID }}
run: |
make init
make build-production
make build-staging
- name: Copy Website to S3 Bucket PR Folder
run: |
Expand Down
83 changes: 14 additions & 69 deletions .github/workflows/website-deploy-staging-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,29 @@ jobs:
steps:
# https://github.com/marketplace/actions/configure-aws-credentials-action-for-github-actions
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ env.IAM_ROLE_ARN }}
role-session-name: ${{ env.IAM_ROLE_SESSION_NAME }}

- name: Checkout Repository
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: "Checkout 'cloudposse/docs' Repository"
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
fetch-depth: 1
repository: cloudposse/docs
ref: master
path: cloudposse-docs
node-version-file: ".nvmrc"

- name: Setup Node
uses: actions/setup-node@v4
- name: "Checkout 'terraform-aws-components' Repository"
uses: actions/checkout@v3
with:
node-version-file: "cloudposse-docs/.nvmrc"
fetch-depth: 1
repository: cloudposse/terraform-aws-components
ref: main
path: tmp/components/terraform-aws-components

- name: "Setup Python"
uses: actions/setup-python@v4
Expand All @@ -66,90 +66,35 @@ jobs:
- name: "Install Python Dependencies"
run: |
make init
pip install -r cloudposse-docs/scripts/docs-collator/requirements.txt
- name: "Install awscli"
run: |
sudo apt-get update && \
sudo apt-get install -y --no-install-recommends awscli
- name: "Checkout 'terraform-aws-components' Repository"
uses: actions/checkout@v4
with:
fetch-depth: 1
repository: cloudposse/terraform-aws-components
ref: main
path: cloudposse-docs/tmp/components/terraform-aws-components
pip install -r scripts/docs-collator/requirements.txt
- name: "Render Documentation for Terraform Components"
run: |
cd cloudposse-docs
./scripts/render-docs-for-components.sh
- name: "Render Documentation for Terraform Modules"
env:
PUBLIC_REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
run: |
cd cloudposse-docs
./scripts/render-docs-for-modules.sh
- name: "Render Documentation for GitHub Actions"
env:
PUBLIC_REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
run: |
cd cloudposse-docs
./scripts/render-docs-for-github-actions.sh
- name: "Pre Rendering Processing"
run: |
make init
make build
./docs/scripts/prepare-static-docs-for-rendering.sh
./docs/scripts/prepare-scaffolding-docs-for-rendering.sh
- name: Install Dependencies and Build Website
env:
GOOGLE_TAG_MANAGER: ${{ env.GOOGLE_TAG_MANAGER }}
GOOGLE_SITE_VERIFICATION_ID: ${{ env.GOOGLE_SITE_VERIFICATION_ID }}
run: |
cd cloudposse-docs/
make init
make build-staging
- name: "Post Rendering Processing"
run: |
./docs/scripts/split-sitemap.sh
# "assets/refarch/handoffs/*" are handled by cloudposse-corp/demos
- name: Copy Website to S3 Bucket
run: |
cd cloudposse-docs/build/
cd build
aws sts get-caller-identity
aws s3 sync . s3://${{ env.S3_BUCKET_NAME }} --delete --exclude "assets/refarch/handoffs/*"
aws s3 sync . s3://${{ env.S3_BUCKET_NAME }} --delete --exclude "pr-*"
aws s3 ls s3://${{ env.S3_BUCKET_NAME }}/ --recursive --human-readable --summarize
- name: Invalidate cache for Cloudfront
run: |
echo "Sending invalidation request"
invalidation_id=$(aws cloudfront create-invalidation \
--distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/*" \
--output json | jq -r '.Invalidation.Id')
echo "Waiting for invalidation to complete..."
aws cloudfront wait invalidation-completed \
--id $invalidation_id \
--distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
echo "done."
- name: Invalidate cache for Cloudflare
run: |
curl -v -X POST \
-d '{"purge_everything": true}' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${{ secrets.CLOUDFLARE_CACHE_PURGE_API_KEY }}" \
"https://api.cloudflare.com/client/v4/zones/${{ vars.CLOUDFLARE_CLOUDPOSSE_COM_ZONE_ID }}/purge_cache"
# Sleep after sending request to give some time before Algolia Index triggers
sleep 30s

0 comments on commit e390e6e

Please sign in to comment.