rebuild-image.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. tag-suffix: "-${{ needs.checkout.outputs.timestamp }}" # distroless
  38. - dockerfile: "Dockerfile.ubi"
  39. tag-suffix: "-ubi-${{ needs.checkout.outputs.timestamp }}"
  40. with:
  41. dockerfile: ${{ matrix.dockerfile }}
  42. ref: ${{ github.event.inputs.ref }}
  43. image-tag: ${{ github.event.inputs.ref }}
  44. tag-suffix: ${{ matrix.tag-suffix }}
  45. image-name: ghcr.io/${{ github.repository }}
  46. secrets:
  47. GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
  48. GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}