1
0

release.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. name: release
  2. on:
  3. push:
  4. branches:
  5. - master
  6. env:
  7. DISCORD_HOOK_URL: ${{ secrets.DISCORD_HOOK_URL }}
  8. GITHUB_SHA: ${{ github.sha }}
  9. HUGO_VERSION: 0.79.1
  10. jobs:
  11. release:
  12. name: Deploy website
  13. runs-on: ubuntu-latest
  14. steps:
  15. - uses: actions/checkout@v2
  16. - name: Configure AWS credentials
  17. uses: aws-actions/configure-aws-credentials@v1
  18. with:
  19. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  20. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  21. aws-region: ${{ secrets.AWS_ACCESS_REGION }}
  22. - name: Build hugo site
  23. run: |
  24. wget https://github.com/gohugoio/hugo/releases/download/v${{ env.HUGO_VERSION }}/hugo_${{ env.HUGO_VERSION }}_Linux-64bit.deb
  25. sudo dpkg -i hugo_${{ env.HUGO_VERSION }}_Linux-64bit.deb
  26. git clone https://github.com/matcornic/hugo-theme-learn ./themes/hugo-theme-learn
  27. hugo
  28. - name: Deploy hugo site to bucket
  29. run: |
  30. aws s3 sync --no-progress --acl public-read public s3://${{ secrets.BUCKET_SITE }}
  31. - name: Invalidate Cloudfront
  32. run: |
  33. aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DIST_ID_SITE }} --paths "/*"