release.yml 2.4 KB

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