release.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. name: Tag-release
  2. on:
  3. push:
  4. tags:
  5. - v*
  6. jobs:
  7. release:
  8. name: New tag release
  9. runs-on: ubuntu-latest
  10. timeout-minutes: 10
  11. strategy:
  12. fail-fast: true
  13. steps:
  14. - name: Checkout
  15. uses: actions/checkout@v4
  16. with:
  17. fetch-depth: 0
  18. - name: Set ENV for github-release
  19. # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
  20. run: |
  21. echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
  22. echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV
  23. - name: Generate changelog
  24. run: |
  25. curl https://github.com/gookit/gitw/releases/latest/download/chlog-linux-amd64 -L -o /usr/local/bin/chlog
  26. chmod a+x /usr/local/bin/chlog
  27. chlog -c .github/changelog.yml -o changelog.md prev last
  28. # https://github.com/softprops/action-gh-release
  29. - name: Create release and upload assets
  30. uses: softprops/action-gh-release@v2
  31. env:
  32. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  33. with:
  34. name: ${{ env.RELEASE_TAG }}
  35. tag_name: ${{ env.RELEASE_TAG }}
  36. body_path: changelog.md
  37. token: ${{ secrets.GITHUB_TOKEN }}