Skip to content

Shorten CLI command #880

Shorten CLI command

Shorten CLI command #880

name: Deploy Production version
on:
push:
branches:
- main
jobs:
deploy-prod:
runs-on: ubuntu-latest
steps:
# Need to get actual deployment URL and not previous one
- name: Get Vercel deployment URL
id: get-url-prod
uses: derrickmehaffy/vercel-preview-url@main
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
with:
vercel_team_id: 'strapijs'
vercel_target: 'production'
vercel_app: 'documentation'
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID }}
# Waits for Vercel to finish building the docs
- name: Wait for Vercel deploy to complete
uses: UnlyEd/[email protected]
id: await-vercel-prod
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
with:
deployment-url: ${{ steps.get-url-prod.outputs.preview_url }}
timeout: 600 # wait 10 minutes before failing
# Outputs the current URL and confirms ready status (for debugging purposes)
- name: Output debug status
run: "echo The deployment at ${{ fromJson(steps.await-vercel-prod.outputs.deploymentDetails).url }} is ${{ fromJson(steps.await-vercel-prod.outputs.deploymentDetails).readyState }}"
# Clears Cloudfront cache
- name: Invalidate CloudFront Cache
uses: chetan/invalidate-cloudfront-action@v2
id: invalid-cloudfront-prod
env:
DISTRIBUTION: ${{ secrets.PROD_DISTRIBUTION }}
PATHS: "/*"
AWS_REGION: ${{ secrets.PROD_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Updates the Algolia Search indexes
- name: Algolia crawler creation and crawl
uses: algolia/[email protected]
id: update-algolia-index-prod
with:
crawler-user-id: ${{ secrets.CRAWLER_USER_ID }}
crawler-api-key: ${{ secrets.CRAWLER_API_KEY }}
algolia-app-id: ${{ secrets.ALGOLIA_APP_ID }}
algolia-api-key: ${{ secrets.ALGOLIA_API_KEY }}
site-url: 'https://docs.strapi.io'
crawler-name: 'strapiDocsNext'