release.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. name: Create Release
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. version:
  6. description: 'version to release, e.g. v1.5.13'
  7. required: true
  8. default: 'v0.1.0'
  9. env:
  10. GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
  11. GO_VERSION: '1.17'
  12. jobs:
  13. release:
  14. name: Create Release
  15. runs-on: ubuntu-latest
  16. steps:
  17. - name: Checkout
  18. uses: actions/checkout@v2
  19. with:
  20. fetch-depth: 0
  21. - name: Create Release
  22. uses: softprops/action-gh-release@v1
  23. with:
  24. tag_name: ${{ github.event.inputs.version }}
  25. env:
  26. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
  27. - name: Build Changelog
  28. id: build_changelog
  29. uses: mikepenz/release-changelog-builder-action@v2
  30. with:
  31. configuration: "changelog.json"
  32. toTag: ${{ github.event.inputs.version }}
  33. commitMode: true
  34. env:
  35. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  36. - name: create changelog file
  37. env:
  38. VERSION: ${{ github.event.inputs.version }}
  39. CHANGELOG: ${{ steps.build_changelog.outputs.changelog }}
  40. run: |
  41. echo "Image: \`ghcr.io/${GITHUB_REPOSITORY}:${VERSION}\`" >> .changelog
  42. echo "${CHANGELOG}" >> .changelog
  43. - name: Update Release
  44. uses: softprops/action-gh-release@v1
  45. with:
  46. tag_name: ${{ github.event.inputs.version }}
  47. body_path: .changelog
  48. env:
  49. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
  50. - name: Setup Go
  51. uses: actions/setup-go@v2
  52. with:
  53. go-version: ${{ env.GO_VERSION }}
  54. - name: Update Docs
  55. run: make docs.publish DOCS_VERSION=${{ github.event.inputs.version }} DOCS_ALIAS=latest
  56. env:
  57. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
  58. promote:
  59. name: Promote Container Image
  60. runs-on: ubuntu-latest
  61. steps:
  62. - name: Checkout
  63. uses: actions/checkout@v2
  64. with:
  65. fetch-depth: 0
  66. - name: Login to Docker
  67. uses: docker/login-action@v1
  68. if: env.GHCR_USERNAME != ''
  69. with:
  70. registry: ghcr.io
  71. username: ${{ secrets.GHCR_USERNAME }}
  72. password: ${{ secrets.GHCR_TOKEN }}
  73. - name: Promote Container Image
  74. if: env.GHCR_USERNAME != ''
  75. run: make docker.promote
  76. env:
  77. RELEASE_TAG: ${{ github.event.inputs.version }}
  78. SOURCE_TAG: main