deploy.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. name: deploy
  2. on:
  3. release:
  4. types: published
  5. jobs:
  6. homebrew-entt:
  7. timeout-minutes: 5
  8. runs-on: ubuntu-latest
  9. env:
  10. GH_REPO: homebrew-entt
  11. FORMULA: entt.rb
  12. steps:
  13. - uses: actions/checkout@v2
  14. with:
  15. ref: 'v3.3.1'
  16. - name: Clone repository
  17. working-directory: build
  18. env:
  19. PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
  20. run: |
  21. git clone https://$GITHUB_ACTOR:$PERSONAL_ACCESS_TOKEN@github.com/$GITHUB_ACTOR/$GH_REPO.git
  22. - name: Prepare formula
  23. working-directory: build
  24. run: |
  25. cd $GH_REPO
  26. curl "https://github.com/${{ github.repository }}/archive/${{ github.ref }}.tar.gz" --location --fail --silent --show-error --output archive.tar.gz
  27. sed -i -e '/url/s/".*"/"'$(echo "https://github.com/${{ github.repository }}/archive/${{ github.ref }}.tar.gz" | sed -e 's/[\/&]/\\&/g')'"/' $FORMULA
  28. sed -i -e '/sha256/s/".*"/"'$(openssl sha256 archive.tar.gz | cut -d " " -f 2)'"/' $FORMULA
  29. - name: Update remote
  30. working-directory: build
  31. run: |
  32. cd $GH_REPO
  33. git config --local user.email "action@github.com"
  34. git config --local user.name "$GITHUB_ACTOR"
  35. git add $FORMULA
  36. git commit -m "Update to ${{ github.ref }}"
  37. git push origin master