trigger.yml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. name: Trigger Repos
  2. on:
  3. push:
  4. branches: master
  5. release:
  6. types:
  7. - created
  8. jobs:
  9. trigger-mynewt:
  10. if: github.repository == 'hathach/tinyusb'
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Trigger mynewt-tinyusb-example
  14. shell: bash
  15. run: |
  16. curl -X POST -H "Authorization: token ${{ secrets.API_TOKEN_GITHUB }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" --data '{"event_type": "rebuild"}' https://api.github.com/repos/hathach/mynewt-tinyusb-example/dispatches
  17. mirror-tinyusb-src:
  18. if: github.repository == 'hathach/tinyusb'
  19. runs-on: ubuntu-latest
  20. steps:
  21. - name: Checkout code
  22. uses: actions/checkout@v2
  23. - name: Push to tinyusb_src
  24. run: |
  25. # clone tinyusb_src with PAT
  26. git config --global user.email "thach@tinyusb.org"
  27. git config --global user.name "hathach"
  28. git clone --depth 1 --single-branch --branch main "https://${{ secrets.API_TOKEN_GITHUB }}@github.com/hathach/tinyusb_src.git" tinyusb_src
  29. # Remove all files
  30. rm -rf tinyusb_src/*
  31. # Copy src and other files
  32. cp -r src tinyusb_src/
  33. cp LICENSE tinyusb_src/
  34. cd tinyusb_src
  35. # Commit if there is changes
  36. if [ -n "$(git status --porcelain)" ]; then
  37. git add .
  38. git commit --message "Update from https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
  39. git push
  40. fi
  41. - name: Create tinyusb_src Release
  42. if: ${{ github.event_name == 'release' }}
  43. run: |
  44. # Push tag
  45. cd tinyusb_src
  46. git tag ${{ github.event.release.tag_name }}
  47. git push origin ${{ github.event.release.tag_name }}
  48. # Send POST reqwuest to release https://docs.github.com/en/rest/reference/repos#create-a-release
  49. curl -X POST -H "Authorization: token ${{ secrets.API_TOKEN_GITHUB }}" -H "Accept: application/vnd.github.v3+json" --data '{"tag_name": "${{ github.event.release.tag_name }}", "name": "${{ github.event.release.name }}", "body": "${{ github.event.release.body }}", "draft": ${{ github.event.release.draft }}, "prerelease": ${{ github.event.release.prerelease }}}' https://api.github.com/repos/hathach/tinyusb_src/releases