release.yml 5.1 KB

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