Use Bitbucket Pipelines as your CI/CD to fetch from Figma, transform the tokens, build the static site, and ship to AWS S3.
This uses the node:16 image. It is designed to fire manually from the UI, or to be scheduled through the BB Pipelines scheduling interface. This pipeline will fetch the tokens, build the code, and upload it to an S3 bucket. It leverages the fact that Bitbucket provides the AWS CLI tooling natively. The second step could be removed and replaced with a command to ship the artifact to a host of your choice.
1image: node:16 2 3pipelines: 4 custom: 5 deploy: 6 - step: 7 name: Build the site 8 caches: 9 - node 10 script: npm install --legacy-peer-deps 11 npm run fetch 12 git commit -a -m "[skip ci] updating changelog with latest figma changes" 13 git push 14 npm run build 15 artifacts: 16 - dist/** 17 - step: 18 name: Deploy to production 19 image: amazon/aws-cli:2.4.14 20 deployment: production 21 services: 22 - docker 23 caches: 24 - docker 25 script: 26 - aws s3 sync --delete out/ s3://bucket-name/ 27 - aws cloudfront create-invalidation --distribution-id {distribution_id} --paths /\* 28