release.yml 4.2 KB

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