mirror of
https://github.com/ivabus/www
synced 2024-11-23 00:05:06 +03:00
108 lines
3.3 KiB
YAML
108 lines
3.3 KiB
YAML
on:
|
||
push:
|
||
branches:
|
||
- main
|
||
paths-ignore:
|
||
- '*.md'
|
||
|
||
concurrency:
|
||
group: deploy
|
||
cancel-in-progress: true
|
||
|
||
env:
|
||
TEA_SECRET: ${{ secrets.TEA_SECRET }}
|
||
|
||
jobs:
|
||
deploy:
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Create Deployment
|
||
uses: bobheadxi/deployments@v1
|
||
id: deployment
|
||
with:
|
||
step: start
|
||
env: aws
|
||
|
||
- uses: actions/checkout@v3
|
||
|
||
- name: Copy packages.json summary from dist.tea.xyz
|
||
uses: prewk/s3-cp-action@v2
|
||
with:
|
||
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||
source: 's3://dist.tea.xyz/mock_packages.json'
|
||
dest: './src/data/packages.json'
|
||
|
||
- name: Create Package Detail Pages from packages.json
|
||
uses: getneil/jq-action@v1
|
||
id: version
|
||
with:
|
||
cmd: '.github/build-package-pages.sh src/data/packages.json src/content/packages'
|
||
|
||
- name: Download package thumbnails from Airtable
|
||
uses: getneil/jq-action@v1
|
||
with:
|
||
cmd: '.github/prepare-thumb-images.sh src/data/packages.json'
|
||
|
||
- name: Upload package thumbnails to AWS S3
|
||
uses: jakejarvis/s3-sync-action@master
|
||
env:
|
||
AWS_S3_BUCKET: www.tea.xyz
|
||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||
AWS_REGION: 'us-east-1'
|
||
SOURCE_DIR: 'packages_thumbs_images'
|
||
DEST_DIR: 'Images/packages'
|
||
|
||
- run: .github/mk-pantry-accessible.sh ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
|
||
- uses: teaxyz/setup@v0
|
||
with:
|
||
target: build
|
||
|
||
- name: Check for broken links
|
||
uses: lycheeverse/lychee-action@v1
|
||
with:
|
||
fail: true
|
||
args: --verbose --no-progress './public/**/*.md' './public/**/*.html'
|
||
env:
|
||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||
|
||
## 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
|
||
|
||
- run: cp -R packages_thumbs_images public/Images/packages
|
||
|
||
# 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: |
|
||
aws s3 sync public s3://www.tea.xyz \
|
||
--metadata-directive REPLACE \
|
||
--cache-control max-age=600 \
|
||
--exclude '.git/*' --exclude '.github/*' \
|
||
--exclude 'pour.sh' \
|
||
--exclude 'tea.white-paper*.pdf' \
|
||
--exclude '*.md' \
|
||
--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
|
||
uses: bobheadxi/deployments@v1
|
||
if: always()
|
||
with:
|
||
step: finish
|
||
status: ${{ job.status }}
|
||
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
|
||
env: ${{ steps.deployment.outputs.env }}
|