Merge pull request #1056 from Aman1905/stage #680
This file contains 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)' | |
on: | |
push: | |
branches: | |
- 'stage' | |
# workflow_dispatch: | |
jobs: | |
Docusaurus: | |
name: 'Deployment' | |
runs-on: ubuntu-latest | |
environment: stage | |
steps: | |
- uses: actions/checkout@v2 | |
- name: echo env vars | |
run: echo ${{ secrets.PROD_WEBSITE_URL }} | |
- name: Find and Replace | |
uses: jacobtomlinson/[email protected] | |
with: | |
find: ${{ secrets.PROD_WEBSITE_URL }} | |
replace: ${{ secrets.STAGE_WEBSITE_URL }} | |
- uses: actions/checkout@v2 | |
- name: Find and Replace | |
uses: jacobtomlinson/[email protected] | |
with: | |
find: "indexName: '${{ secrets.PROD_INDEX }}'," | |
replace: "indexName: '${{ secrets.STAGE_INDEX }}'," | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DOCS_STAGING }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DOCS_STAGING }} | |
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 | |
- run: npm -v && node -v | |
- run: npm install --legacy-peer-deps && npm run build | |
env: | |
CI: false | |
- name: Copy files to the test website with the AWS CLI | |
run: | | |
cp -R assets/ build/ | |
cd build/ | |
aws s3 sync . s3://lambdatest-stage-docs/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.STAGE_WEBSITE_URL }}"] }' | |
- name: Sleep Invalidation | |
run: | | |
sleep 10; |