release.yml 4.4 KB

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