release.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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@v1.8.0
  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. promote:
  50. name: Promote Container Image
  51. runs-on: ubuntu-latest
  52. steps:
  53. - name: Checkout
  54. uses: actions/checkout@v2
  55. with:
  56. fetch-depth: 0
  57. - name: Login to Docker
  58. uses: docker/login-action@v1
  59. if: env.GHCR_USERNAME != ''
  60. with:
  61. registry: ghcr.io
  62. username: ${{ secrets.GHCR_USERNAME }}
  63. password: ${{ secrets.GHCR_TOKEN }}
  64. - name: Promote Container Image
  65. if: env.GHCR_USERNAME != ''
  66. run: make docker.promote
  67. env:
  68. RELEASE_TAG: ${{ github.event.inputs.version }}