2022-03-25 16:52:12 +03:00
|
|
|
|
on:
|
|
|
|
|
push:
|
2022-04-25 22:06:30 +03:00
|
|
|
|
branches:
|
|
|
|
|
- main
|
2022-04-25 19:41:24 +03:00
|
|
|
|
paths-ignore:
|
2022-03-25 16:52:12 +03:00
|
|
|
|
- '**/*.md'
|
2022-03-14 17:54:16 +03:00
|
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
|
group: deploy
|
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
deploy:
|
|
|
|
|
runs-on: ubuntu-latest
|
2022-04-25 19:41:24 +03:00
|
|
|
|
if: github.ref == 'refs/heads/main'
|
2022-03-14 17:54:16 +03:00
|
|
|
|
steps:
|
|
|
|
|
- name: Create Deployment
|
2022-05-04 22:08:51 +03:00
|
|
|
|
uses: bobheadxi/deployments@v1
|
2022-03-14 17:54:16 +03:00
|
|
|
|
id: deployment
|
|
|
|
|
with:
|
|
|
|
|
step: start
|
|
|
|
|
token: ${{ github.token }}
|
|
|
|
|
env: aws
|
|
|
|
|
|
2022-05-04 22:08:51 +03:00
|
|
|
|
- uses: actions/checkout@v3
|
2022-03-14 17:54:16 +03:00
|
|
|
|
|
|
|
|
|
## means s3 sync will only sync things we need sync’d
|
|
|
|
|
- uses: chetan/git-restore-mtime-action@v1
|
|
|
|
|
|
|
|
|
|
- uses: aws-actions/configure-aws-credentials@v1
|
|
|
|
|
with:
|
|
|
|
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
|
aws-region: us-east-1
|
|
|
|
|
|
|
|
|
|
# cache-control of 10 mins because we *need* to be able to update
|
|
|
|
|
# this and have people see the results can be fixed well with a static site builder
|
|
|
|
|
- run: |
|
2022-04-25 19:41:24 +03:00
|
|
|
|
aws s3 sync public s3://www.tea.xyz \
|
2022-03-14 17:54:16 +03:00
|
|
|
|
--metadata-directive REPLACE \
|
|
|
|
|
--cache-control max-age=600 \
|
|
|
|
|
--exclude '.git/*' --exclude '.github/*' \
|
2022-05-04 04:06:13 +03:00
|
|
|
|
--exclude 'pour.sh' \
|
2022-05-19 15:21:03 +03:00
|
|
|
|
--exclude 'tea.white-paper.pdf' \
|
2022-03-25 16:39:06 +03:00
|
|
|
|
--exclude '*.md' \
|
2022-03-14 17:54:16 +03:00
|
|
|
|
--delete
|
|
|
|
|
|
|
|
|
|
#TODO create a github-action that can be used to parse the
|
|
|
|
|
# output from `s3 sync` into invalidation commands. NOTE
|
|
|
|
|
# I have already looked for something to do this and failed.
|
|
|
|
|
- run: |
|
|
|
|
|
aws cloudfront create-invalidation \
|
|
|
|
|
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }} \
|
|
|
|
|
--paths '/*'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Seal Deployment
|
2022-05-04 22:08:51 +03:00
|
|
|
|
uses: bobheadxi/deployments@v1
|
2022-03-14 17:54:16 +03:00
|
|
|
|
if: always()
|
|
|
|
|
with:
|
|
|
|
|
step: finish
|
|
|
|
|
token: ${{ github.token }}
|
|
|
|
|
status: ${{ job.status }}
|
|
|
|
|
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
|
2022-05-04 22:08:51 +03:00
|
|
|
|
env: ${{ steps.deployment.outputs.env }}
|