release_render.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. name: Create Release for Render
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. version:
  6. description: 'version to release, e.g. v0.1.0-render'
  7. required: true
  8. default: 'v0.1.0-render'
  9. source_ref:
  10. description: 'source ref to publish from. E.g.: main or release-x.y'
  11. required: true
  12. default: 'main'
  13. jobs:
  14. release:
  15. name: Create Release for Render
  16. runs-on: ubuntu-latest
  17. steps:
  18. - name: Checkout
  19. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
  20. with:
  21. fetch-depth: 0
  22. ref: ${{ github.event.inputs.source_ref }}
  23. - name: Setup Go
  24. uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
  25. id: setup-go
  26. with:
  27. go-version-file: "go.mod"
  28. - name: Download Go modules
  29. if: ${{ steps.setup-go.outputs.cache-hit != 'true' }}
  30. run: go mod download
  31. - name: Install Syft
  32. uses: anchore/sbom-action/download-syft@v0.17.9
  33. - name: Import GPG key
  34. id: import_gpg
  35. uses: crazy-max/ghaction-import-gpg@v6
  36. with:
  37. gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
  38. passphrase: ${{ secrets.GPG_PASSPHRASE }}
  39. - name: Check if Tag Exists
  40. id: check_tag
  41. run: |
  42. if git rev-parse "${{ github.event.inputs.version }}" >/dev/null 2>&1; then
  43. echo "Tag exists."
  44. exit 1
  45. fi
  46. - name: Create Tag if Not Exists
  47. if: success()
  48. run: |
  49. TAG="${{ github.event.inputs.version }}"
  50. git tag $TAG
  51. git push origin $TAG
  52. - name: Run GoReleaser
  53. uses: goreleaser/goreleaser-action@v6.1.0
  54. with:
  55. version: '~> v2'
  56. args: release --clean
  57. workdir: cmd/render
  58. env:
  59. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  60. GORELEASER_CURRENT_TAG: ${{ github.event.inputs.version }}
  61. GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}