Skip to content

Deploy Demos to Production #101

Deploy Demos to Production

Deploy Demos to Production #101

name: Deploy Demos to Production
on:
workflow_dispatch:
jobs:
deploy-json-demos-to-production:
runs-on: ubuntu-latest
env:
AWS_REGION: ${{ secrets.aws_region }}
steps:
- name: Pull staging bucket
env:
AWS_ACCESS_KEY_ID: ${{ secrets.PL_SITE_STAGING_NON_REACT_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PL_SITE_STAGING_NON_REACT_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET_ID: ${{ secrets.PL_SITE_STAGING_QML_JSON_S3_BUCKET_ID }}
AWS_S3_HTML_BUCKET_ID: ${{ secrets.PL_SITE_STAGING_S3_BUCKET_NAME }}
run: |
aws s3 cp --recursive s3://$AWS_S3_BUCKET_ID/master ./local-master
aws s3 cp s3://$AWS_S3_HTML_BUCKET_ID/qml/searchindex.js searchindex.js
aws s3 cp s3://$AWS_S3_HTML_BUCKET_ID/qml/objects.inv objects.inv
- name: Push production bucket
env:
AWS_ACCESS_KEY_ID: ${{ secrets.PL_SITE_PROD_NON_REACT_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PL_SITE_PROD_NON_REACT_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET_ID: ${{ secrets.PL_SITE_PROD_QML_JSON_S3_BUCKET_ID }}
AWS_S3_HTML_BUCKET_ID: ${{ secrets.PL_SITE_PROD_S3_BUCKET_NAME }}
run: |
aws s3 sync ./local-master s3://$AWS_S3_BUCKET_ID/master --delete
aws s3 cp searchindex.js s3://$AWS_S3_HTML_BUCKET_ID/qml/searchindex.js
aws s3 cp objects.inv s3://$AWS_S3_HTML_BUCKET_ID/qml/objects.inv
- name: Trigger production website build
uses: peter-evans/repository-dispatch@v2
env:
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
with:
token: ${{ secrets.PL_SITE_PROD_QML_REACT_PAT }}
repository: XanaduAI/pennylane.ai-react
event-type: build-pl-site-main
client-payload: '{"actor": "${{ github.actor }}", "triggering_actor": "${{ github.triggering_actor }}", "source_run_url": "${{ env.RUN_URL }}"}'
deploy-text-demos-to-production:
runs-on: ubuntu-latest
env:
AWS_REGION: ${{ secrets.aws_region }}
steps:
- name: Pull staging bucket
env:
AWS_ACCESS_KEY_ID: ${{ secrets.STAGING_GLASS_ONION_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.STAGING_GLASS_ONION_AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET_ID: ${{ secrets.STAGING_GLASS_ONION_DEMOS_BUCKET_ID }}
run: |
aws s3 cp --recursive s3://$AWS_S3_BUCKET_ID ./demos
- name: Push production bucket
env:
AWS_ACCESS_KEY_ID: ${{ secrets.PROD_GLASS_ONION_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PROD_GLASS_ONION_AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET_ID: ${{ secrets.PROD_GLASS_ONION_DEMOS_BUCKET_ID }}
run: |
aws s3 sync ./demos s3://$AWS_S3_BUCKET_ID --delete