release.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. source_ref:
  10. description: 'source ref to publish from. E.g.: main or release-x.y'
  11. required: true
  12. default: 'main'
  13. env:
  14. IMAGE_NAME: ghcr.io/${{ github.repository }}
  15. jobs:
  16. release:
  17. name: Create Release
  18. runs-on: ubuntu-latest
  19. steps:
  20. - name: Checkout
  21. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
  22. with:
  23. fetch-depth: 0
  24. ref: ${{ github.event.inputs.source_ref }}
  25. - name: Create Release
  26. uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
  27. with:
  28. tag_name: ${{ github.event.inputs.version }}
  29. target_commitish: ${{ github.event.inputs.source_ref }}
  30. generate_release_notes: true
  31. body: |
  32. Image: `${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}`
  33. Image: `${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}-ubi`
  34. Image: `${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}-ubi-boringssl`
  35. env:
  36. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
  37. - name: Configure Git
  38. run: |
  39. git config user.name "$GITHUB_ACTOR"
  40. git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
  41. - name: Update Docs
  42. if: github.ref == 'refs/heads/main'
  43. run: make docs.publish DOCS_VERSION=${{ github.event.inputs.version }} DOCS_ALIAS=latest
  44. env:
  45. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
  46. promote:
  47. name: Promote Container Image
  48. runs-on: ubuntu-latest
  49. strategy:
  50. matrix:
  51. include:
  52. - tag_suffix: "" # distroless image
  53. - tag_suffix: "-ubi" # ubi image
  54. - tag_suffix: "-ubi-boringssl" # ubi image
  55. permissions:
  56. id-token: write
  57. contents: write
  58. env:
  59. SOURCE_TAG: ${{ github.event.inputs.source_ref }}${{ matrix.tag_suffix }}
  60. RELEASE_TAG: ${{ github.event.inputs.version }}${{ matrix.tag_suffix }}
  61. steps:
  62. - name: Checkout
  63. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
  64. with:
  65. fetch-depth: 0
  66. - name: Setup Go
  67. uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
  68. id: setup-go
  69. with:
  70. go-version-file: "go.mod"
  71. - name: Download Go modules
  72. if: ${{ steps.setup-go.outputs.cache-hit != 'true' }}
  73. run: go mod download
  74. - name: Login to Docker
  75. uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
  76. with:
  77. registry: ghcr.io
  78. username: ${{ secrets.GHCR_USERNAME }}
  79. password: ${{ secrets.GHCR_TOKEN }}
  80. - name: Promote Container Image
  81. run: make docker.promote
  82. - name: Build release manifests
  83. run: |
  84. # temporarily patch the version so we generate manifests with the new version
  85. yq e -i '.version = "${{ github.event.inputs.version }}"' ./deploy/charts/external-secrets/Chart.yaml
  86. yq e -i '.appVersion = "${{ github.event.inputs.version }}"' ./deploy/charts/external-secrets/Chart.yaml
  87. make manifests
  88. - name: Sign promoted image
  89. id: sign
  90. uses: ./.github/actions/sign
  91. with:
  92. image-name: ${{ env.IMAGE_NAME }}
  93. image-tag: ${{ env.RELEASE_TAG }}
  94. GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
  95. GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}
  96. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  97. - name: Update Release
  98. uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
  99. with:
  100. tag_name: ${{ github.event.inputs.version }}
  101. files: |
  102. provenance.${{ env.RELEASE_TAG }}.intoto.jsonl
  103. sbom.${{ env.RELEASE_TAG }}.spdx.json
  104. bin/deploy/manifests/external-secrets.yaml
  105. env:
  106. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"