rebuild-image.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. jobs:
  10. checkout:
  11. name: Checkout repo
  12. runs-on: ubuntu-latest
  13. outputs:
  14. timestamp: ${{ steps.timestamp.outputs.timestamp }}
  15. steps:
  16. - name: Checkout
  17. uses: actions/checkout@v3
  18. with:
  19. fetch-depth: 0
  20. ref: ${{ github.event.inputs.ref }}
  21. - name: set timestamp output
  22. id: timestamp
  23. run: |
  24. echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
  25. # this rebuilds the image and creates a new tag with a timestamp suffix
  26. # e.g. v0.6.1-1669145271 and v0.6.1-ubi-1669145271
  27. publish-artifacts:
  28. uses: ./.github/workflows/publish.yml
  29. needs: checkout
  30. permissions:
  31. id-token: write
  32. contents: read
  33. strategy:
  34. matrix:
  35. include:
  36. - dockerfile: "Dockerfile"
  37. build-args: "CGO_ENABLED=0"
  38. build-arch: "amd64 arm64"
  39. build-platform: "linux/amd64,linux/arm64"
  40. tag-suffix: "-${{ needs.checkout.outputs.timestamp }}" # distroless
  41. - dockerfile: "Dockerfile.ubi"
  42. build-args: "CGO_ENABLED=0"
  43. build-arch: "amd64 arm64"
  44. build-platform: "linux/amd64,linux/arm64"
  45. tag-suffix: "-ubi-${{ needs.checkout.outputs.timestamp }}" # ubi
  46. - dockerfile: "Dockerfile.ubi"
  47. build-args: "CGO_ENABLED=0 GOEXPERIMENT=boringcrypto" # fips
  48. build-arch: "amd64"
  49. build-platform: "linux/amd64"
  50. tag-suffix: "-ubi-boringssl-${{ needs.checkout.outputs.timestamp }}"
  51. with:
  52. dockerfile: ${{ matrix.dockerfile }}
  53. tag-suffix: ${{ matrix.tag-suffix }}
  54. image-name: ghcr.io/${{ github.repository }}
  55. build-platform: ${{ matrix.build-platform }}
  56. build-args: ${{ matrix.build-args }}
  57. build-arch: ${{ matrix.build-arch }}
  58. ref: ${{ github.event.inputs.ref }}
  59. image-tag: ${{ github.event.inputs.ref }}
  60. secrets:
  61. GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
  62. GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}