deploy.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. name: deploy
  2. on:
  3. push:
  4. branches:
  5. - master
  6. repository_dispatch:
  7. types: [build]
  8. workflow_dispatch:
  9. jobs:
  10. release:
  11. name: Build and deploy site
  12. runs-on: ubuntu-latest
  13. if: "!contains(github.event.head_commit.message, '[skip ci]')"
  14. steps:
  15. - name: Checkout
  16. uses: actions/checkout@v2
  17. - name: Download external project files
  18. run: |
  19. wget https://raw.githubusercontent.com/netbootxyz/netboot.xyz/master/CHANGELOG.md -O external/CHANGELOG.md
  20. - name: Setup Node.js
  21. uses: actions/setup-node@v2
  22. with:
  23. node-version: 14
  24. - name: Install dependencies
  25. run: yarn install
  26. - name: Build static site
  27. run: yarn run build
  28. - name: Configure AWS credentials
  29. uses: aws-actions/configure-aws-credentials@v1
  30. with:
  31. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  32. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  33. aws-region: ${{ secrets.AWS_ACCESS_REGION }}
  34. - name: Deploy site to bucket
  35. run: |
  36. aws s3 sync --no-progress --acl public-read build s3://${{ secrets.BUCKET_SITE }}
  37. - name: Invalidate Cloudfront
  38. run: |
  39. aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DIST_ID_SITE }} --paths "/*"