Merge pull request #2560 from surishubham/stage #94
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'Deployment (Stage - New Bucket)' | |
| on: | |
| push: | |
| branches: | |
| - stage | |
| jobs: | |
| Docusaurus: | |
| name: 'Deployment' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: stage | |
| fetch-depth: 0 | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_MKT }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_MKT }} | |
| aws-region: us-east-1 | |
| - name: 'Create env file' | |
| run: | | |
| touch .env | |
| echo "HOST=${{ secrets.TYPESENSE_HOST }}" >> .env | |
| echo "API=${{ secrets.PUBLIC_APY_TYPESENSE }}" >> .env | |
| - name: Use Node.js 20.10.x | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 20.10.x | |
| - name: Install dependencies and build | |
| run: npm install --legacy-peer-deps && npm run build | |
| env: | |
| CI: false | |
| - name: Copy files to S3 with AWS CLI | |
| run: | | |
| cp -R assets/ build/ | |
| cd build/ | |
| aws s3 sync . s3://lambdatest-stage-support-docs-testmu/support/ --exclude 'robots.txt' --delete | |
| - name: Invalidate CloudFront | |
| run: | | |
| aws cloudfront create-invalidation \ | |
| --distribution-id EEMGB6PM4ZZ7A \ | |
| --paths "/support/*" | |
| sleep 90 | |
| - name: Cloudflare Invalidation | |
| run: | | |
| curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE_ID }}/purge_cache" \ | |
| -H "X-Auth-Email: ${{ secrets.CF_ACCOUNT }}" \ | |
| -H "X-Auth-Key: ${{ secrets.CF_API_SECRET }}" \ | |
| -H "Content-Type: application/json" \ | |
| --data '{"hosts":["${{ secrets.PROD_WEBSITE_URL }}"] }' | |
| sleep 60 |