deploy.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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@v3
  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. wget https://raw.githubusercontent.com/netbootxyz/build-pipelines/master/README.md -O external/build-automation.md
  21. wget https://raw.githubusercontent.com/netbootxyz/netboot.xyz/master/CONTRIBUTING.md -O external/contributing.md
  22. curl https://raw.githubusercontent.com/netbootxyz/docker-netbootxyz/master/README.md | tail -n+6 > external/docker.md
  23. - name: Setup Node.js
  24. uses: actions/setup-node@v3
  25. with:
  26. node-version: 16
  27. - name: Install dependencies
  28. run: yarn install
  29. - name: Build static site
  30. run: yarn run build
  31. - name: Configure AWS credentials
  32. uses: aws-actions/configure-aws-credentials@v1
  33. with:
  34. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  35. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  36. aws-region: ${{ secrets.AWS_ACCESS_REGION }}
  37. - name: Deploy site to bucket
  38. run: |
  39. aws s3 sync --no-progress --acl public-read build s3://${{ secrets.BUCKET_SITE }}
  40. - name: Invalidate Cloudfront
  41. run: |
  42. aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DIST_ID_SITE }} --paths "/*"