release.yml 1.2 KB

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