release.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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'
  11. required: true
  12. default: 'main'
  13. env:
  14. IMAGE_NAME: ghcr.io/${{ github.repository }}
  15. permissions:
  16. contents: read
  17. jobs:
  18. check-docs-for-release:
  19. name: Check Docs for release
  20. runs-on: ubuntu-latest
  21. permissions:
  22. contents: read
  23. steps:
  24. - name: Harden the runner (Audit all outbound calls)
  25. uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
  26. with:
  27. egress-policy: audit
  28. - name: Checkout
  29. uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
  30. with:
  31. fetch-depth: 0
  32. ref: ${{ github.event.inputs.source_ref }}
  33. - name: check-docs
  34. env:
  35. DOCS_VERSION: ${{ github.event.inputs.version }}
  36. run: |
  37. make docs.check
  38. release:
  39. name: Create Release
  40. runs-on: ubuntu-latest
  41. permissions:
  42. contents: write # to create a release and push new docs
  43. steps:
  44. - name: Harden the runner (Audit all outbound calls)
  45. uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
  46. with:
  47. egress-policy: audit
  48. - name: Checkout
  49. uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
  50. with:
  51. fetch-depth: 0
  52. ref: ${{ github.event.inputs.source_ref }}
  53. - name: Create Release
  54. uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
  55. with:
  56. tag_name: ${{ github.event.inputs.version }}
  57. target_commitish: ${{ github.event.inputs.source_ref }}
  58. generate_release_notes: true
  59. body: |
  60. Image: `${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}`
  61. Image: `${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}-ubi`
  62. Image: `${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}-ubi-boringssl`
  63. env:
  64. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
  65. - name: Configure Git
  66. run: |
  67. git config user.name "$GITHUB_ACTOR"
  68. git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
  69. - name: Update Docs
  70. if: github.ref == 'refs/heads/main'
  71. env:
  72. DOCS_VERSION: ${{ github.event.inputs.version }}
  73. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
  74. run: make docs.publish DOCS_ALIAS=latest
  75. promote:
  76. name: Promote Container Image
  77. runs-on: ubuntu-latest
  78. strategy:
  79. matrix:
  80. include:
  81. - tag_suffix: "" # distroless image
  82. - tag_suffix: "-ubi" # ubi image
  83. - tag_suffix: "-ubi-boringssl" # ubi image
  84. permissions:
  85. contents: write #to update the github release
  86. id-token: write #for keyless sign
  87. packages: write #to update packages with added SBOMs.
  88. env:
  89. SOURCE_TAG: ${{ github.event.inputs.source_ref }}${{ matrix.tag_suffix }}
  90. RELEASE_TAG: ${{ github.event.inputs.version }}${{ matrix.tag_suffix }}
  91. steps:
  92. - uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
  93. with:
  94. egress-policy: audit
  95. - name: Checkout
  96. uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
  97. with:
  98. fetch-depth: 0
  99. - name: Setup Go
  100. uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
  101. id: setup-go
  102. with:
  103. go-version-file: "go.mod"
  104. - name: Download Go modules
  105. if: ${{ steps.setup-go.outputs.cache-hit != 'true' }}
  106. run: go mod download
  107. - name: Login to Docker
  108. uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
  109. with:
  110. registry: ghcr.io
  111. username: ${{ github.actor }}
  112. password: ${{ secrets.GITHUB_TOKEN }}
  113. - name: Promote Container Image
  114. run: make docker.promote
  115. - name: Build release manifests
  116. env:
  117. RELEASE_VERSION: ${{ github.event.inputs.version }}
  118. run: |
  119. # temporarily patch the version so we generate manifests with the new version
  120. yq e -i ".version = \"$RELEASE_VERSION\"" ./deploy/charts/external-secrets/Chart.yaml
  121. yq e -i ".appVersion = \"$RELEASE_VERSION\"" ./deploy/charts/external-secrets/Chart.yaml
  122. make manifests
  123. - name: Sign promoted image
  124. id: sign
  125. uses: ./.github/actions/sign
  126. with:
  127. image-name: ${{ env.IMAGE_NAME }}
  128. image-tag: ${{ env.RELEASE_TAG }}
  129. - name: Update Release
  130. uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
  131. with:
  132. tag_name: ${{ github.event.inputs.version }}
  133. files: |
  134. provenance.${{ env.RELEASE_TAG }}.intoto.jsonl
  135. sbom.${{ env.RELEASE_TAG }}.spdx.json
  136. bin/deploy/manifests/external-secrets.yaml
  137. env:
  138. GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"