rebuild-image.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. name: Rebuild
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. ref:
  6. description: 'ref to rebuild, can be a tag, branch or commit sha.'
  7. required: true
  8. default: 'v0.6.1'
  9. permissions:
  10. contents: read
  11. jobs:
  12. checkout:
  13. name: Checkout repo
  14. runs-on: ubuntu-latest
  15. outputs:
  16. timestamp: ${{ steps.timestamp.outputs.timestamp }}
  17. steps:
  18. - uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
  19. with:
  20. egress-policy: audit
  21. - name: Checkout
  22. uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
  23. with:
  24. fetch-depth: 0
  25. ref: ${{ github.event.inputs.ref }}
  26. - name: set timestamp output
  27. id: timestamp
  28. run: |
  29. echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
  30. # this rebuilds the image and creates a new tag with a timestamp suffix
  31. # e.g. v0.6.1-1669145271 and v0.6.1-ubi-1669145271
  32. publish-artifacts:
  33. uses: ./.github/workflows/publish.yml
  34. needs: checkout
  35. permissions:
  36. contents: read
  37. id-token: write #for keyless sign
  38. packages: write #for updating packages
  39. strategy:
  40. matrix:
  41. include:
  42. - dockerfile: "Dockerfile"
  43. build-args: "CGO_ENABLED=0"
  44. build-arch: "amd64 arm64 ppc64le"
  45. build-platform: "linux/amd64,linux/arm64,linux/ppc64le"
  46. tag-suffix: "-${{ needs.checkout.outputs.timestamp }}" # distroless
  47. - dockerfile: "Dockerfile.ubi"
  48. build-args: "CGO_ENABLED=0"
  49. build-arch: "amd64 arm64 ppc64le"
  50. build-platform: "linux/amd64,linux/arm64,linux/ppc64le"
  51. tag-suffix: "-ubi-${{ needs.checkout.outputs.timestamp }}" # ubi
  52. - dockerfile: "Dockerfile.ubi"
  53. build-args: "CGO_ENABLED=0 GOEXPERIMENT=boringcrypto" # fips
  54. build-arch: "amd64 ppc64le"
  55. build-platform: "linux/amd64,linux/ppc64le"
  56. tag-suffix: "-ubi-boringssl-${{ needs.checkout.outputs.timestamp }}"
  57. with:
  58. dockerfile: ${{ matrix.dockerfile }}
  59. tag-suffix: ${{ matrix.tag-suffix }}
  60. image-name: ghcr.io/${{ github.repository }}
  61. build-platform: ${{ matrix.build-platform }}
  62. build-args: ${{ matrix.build-args }}
  63. build-arch: ${{ matrix.build-arch }}
  64. ref: ${{ github.event.inputs.ref }}
  65. image-tag: ${{ github.event.inputs.ref }}
  66. username: ${{ github.actor }}
  67. secrets:
  68. IS_FORK: ${{ secrets.GHCR_USERNAME }}