rebuild-image.yml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
  19. with:
  20. egress-policy: audit
  21. - name: Checkout
  22. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  23. with:
  24. fetch-depth: 0
  25. ref: ${{ github.event.inputs.ref }}
  26. persist-credentials: false
  27. - name: set timestamp output
  28. id: timestamp
  29. run: |
  30. echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
  31. # this rebuilds the image and creates a new tag with a timestamp suffix
  32. # e.g. v0.6.1-1669145271 and v0.6.1-ubi-1669145271
  33. publish-artifacts:
  34. uses: ./.github/workflows/publish.yml
  35. needs: checkout
  36. permissions:
  37. contents: read
  38. id-token: write #for keyless sign
  39. packages: write #for updating packages
  40. strategy:
  41. matrix:
  42. include:
  43. - dockerfile: "Dockerfile"
  44. build-args: "CGO_ENABLED=0"
  45. build-arch: "amd64 arm64 ppc64le"
  46. build-platform: "linux/amd64,linux/arm64,linux/ppc64le"
  47. tag-suffix: "-${{ needs.checkout.outputs.timestamp }}" # distroless
  48. - dockerfile: "Dockerfile.ubi"
  49. build-args: "CGO_ENABLED=0"
  50. build-arch: "amd64 arm64 ppc64le"
  51. build-platform: "linux/amd64,linux/arm64,linux/ppc64le"
  52. tag-suffix: "-ubi-${{ needs.checkout.outputs.timestamp }}" # ubi
  53. - dockerfile: "Dockerfile.ubi"
  54. build-args: "CGO_ENABLED=0 GOEXPERIMENT=boringcrypto" # fips
  55. build-arch: "amd64 ppc64le"
  56. build-platform: "linux/amd64,linux/ppc64le"
  57. tag-suffix: "-ubi-boringssl-${{ needs.checkout.outputs.timestamp }}"
  58. with:
  59. dockerfile: ${{ matrix.dockerfile }}
  60. tag-suffix: ${{ matrix.tag-suffix }}
  61. image-name: ghcr.io/${{ github.repository }}
  62. build-platform: ${{ matrix.build-platform }}
  63. build-args: ${{ matrix.build-args }}
  64. build-arch: ${{ matrix.build-arch }}
  65. ref: ${{ github.event.inputs.ref }}
  66. image-tag: ${{ github.event.inputs.ref }}
  67. username: ${{ github.actor }}
  68. secrets:
  69. IS_FORK: ${{ secrets.GHCR_USERNAME }}