|
| 1 | +# ============================================================================= |
| 2 | +# Publish Tenant Images — proxy + dashboard images for the multi-tenant |
| 3 | +# Basilica lifecycle. |
| 4 | +# |
| 5 | +# Unlike release.yml (tag-triggered, cuts a real release + crates.io + PyPI), |
| 6 | +# this workflow only builds + pushes container images to GHCR under the |
| 7 | +# techlab-innov org. Two trigger paths: |
| 8 | +# |
| 9 | +# - push to main → publish `:main` and `:sha-<short>` tags (auto) |
| 10 | +# - workflow_dispatch → optionally tag as `:latest` and/or a custom label |
| 11 | +# |
| 12 | +# The product's `tenant-lifecycle.yml` workflow references the published |
| 13 | +# images via the per-tenant config file (image: ghcr.io/techlab-innov/...). |
| 14 | +# ============================================================================= |
| 15 | +name: publish-images |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + branches: |
| 20 | + - main |
| 21 | + paths: |
| 22 | + - "crates/**" |
| 23 | + - "Cargo.toml" |
| 24 | + - "Cargo.lock" |
| 25 | + - "Dockerfile" |
| 26 | + - "dashboard/**" |
| 27 | + - ".github/workflows/publish-images.yml" |
| 28 | + workflow_dispatch: |
| 29 | + inputs: |
| 30 | + tag: |
| 31 | + description: "Additional image tag to publish (e.g. 'latest', 'rc1')" |
| 32 | + required: false |
| 33 | + type: string |
| 34 | + default: "latest" |
| 35 | + mark_latest: |
| 36 | + description: "Publish :latest alongside the sha + tag" |
| 37 | + required: false |
| 38 | + type: boolean |
| 39 | + default: true |
| 40 | + |
| 41 | +permissions: |
| 42 | + contents: read |
| 43 | + packages: write |
| 44 | + |
| 45 | +env: |
| 46 | + REGISTRY: ghcr.io |
| 47 | + OWNER: techlab-innov |
| 48 | + |
| 49 | +jobs: |
| 50 | + proxy: |
| 51 | + name: Proxy image |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 55 | + |
| 56 | + - uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3 |
| 57 | + |
| 58 | + - uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 |
| 59 | + |
| 60 | + - name: Log in to GHCR |
| 61 | + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3 |
| 62 | + with: |
| 63 | + registry: ${{ env.REGISTRY }} |
| 64 | + username: ${{ github.actor }} |
| 65 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + |
| 67 | + - name: Compute tags |
| 68 | + id: tags |
| 69 | + env: |
| 70 | + MARK_LATEST: ${{ inputs.mark_latest }} |
| 71 | + CUSTOM_TAG: ${{ inputs.tag }} |
| 72 | + run: | |
| 73 | + set -euo pipefail |
| 74 | + image="${REGISTRY}/${OWNER}/llmtrace-proxy" |
| 75 | + short_sha="${GITHUB_SHA::7}" |
| 76 | + tags=("${image}:sha-${short_sha}" "${image}:main") |
| 77 | + if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then |
| 78 | + [[ -n "${CUSTOM_TAG}" ]] && tags+=("${image}:${CUSTOM_TAG}") |
| 79 | + [[ "${MARK_LATEST}" == "true" ]] && tags+=("${image}:latest") |
| 80 | + else |
| 81 | + # Auto push from main always refreshes :latest |
| 82 | + tags+=("${image}:latest") |
| 83 | + fi |
| 84 | + printf 'tags=' >> "${GITHUB_OUTPUT}" |
| 85 | + printf '%s,' "${tags[@]}" | sed 's/,$//' >> "${GITHUB_OUTPUT}" |
| 86 | + printf '\n' >> "${GITHUB_OUTPUT}" |
| 87 | + printf 'tags computed:\n'; printf ' %s\n' "${tags[@]}" |
| 88 | +
|
| 89 | + - name: Build and push |
| 90 | + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6 |
| 91 | + with: |
| 92 | + context: . |
| 93 | + file: Dockerfile |
| 94 | + push: true |
| 95 | + platforms: linux/amd64,linux/arm64 |
| 96 | + tags: ${{ steps.tags.outputs.tags }} |
| 97 | + labels: | |
| 98 | + org.opencontainers.image.source=https://github.com/${{ github.repository }} |
| 99 | + org.opencontainers.image.revision=${{ github.sha }} |
| 100 | + org.opencontainers.image.created=${{ github.event.head_commit.timestamp }} |
| 101 | + cache-from: type=gha,scope=proxy |
| 102 | + cache-to: type=gha,mode=max,scope=proxy |
| 103 | + |
| 104 | + dashboard: |
| 105 | + name: Dashboard image |
| 106 | + runs-on: ubuntu-latest |
| 107 | + steps: |
| 108 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 109 | + |
| 110 | + - uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3 |
| 111 | + |
| 112 | + - uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 |
| 113 | + |
| 114 | + - name: Log in to GHCR |
| 115 | + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3 |
| 116 | + with: |
| 117 | + registry: ${{ env.REGISTRY }} |
| 118 | + username: ${{ github.actor }} |
| 119 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 120 | + |
| 121 | + - name: Compute tags |
| 122 | + id: tags |
| 123 | + env: |
| 124 | + MARK_LATEST: ${{ inputs.mark_latest }} |
| 125 | + CUSTOM_TAG: ${{ inputs.tag }} |
| 126 | + run: | |
| 127 | + set -euo pipefail |
| 128 | + image="${REGISTRY}/${OWNER}/llmtrace-dashboard" |
| 129 | + short_sha="${GITHUB_SHA::7}" |
| 130 | + tags=("${image}:sha-${short_sha}" "${image}:main") |
| 131 | + if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then |
| 132 | + [[ -n "${CUSTOM_TAG}" ]] && tags+=("${image}:${CUSTOM_TAG}") |
| 133 | + [[ "${MARK_LATEST}" == "true" ]] && tags+=("${image}:latest") |
| 134 | + else |
| 135 | + tags+=("${image}:latest") |
| 136 | + fi |
| 137 | + printf 'tags=' >> "${GITHUB_OUTPUT}" |
| 138 | + printf '%s,' "${tags[@]}" | sed 's/,$//' >> "${GITHUB_OUTPUT}" |
| 139 | + printf '\n' >> "${GITHUB_OUTPUT}" |
| 140 | + printf 'tags computed:\n'; printf ' %s\n' "${tags[@]}" |
| 141 | +
|
| 142 | + - name: Build and push |
| 143 | + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6 |
| 144 | + with: |
| 145 | + context: ./dashboard |
| 146 | + file: ./dashboard/Dockerfile |
| 147 | + push: true |
| 148 | + platforms: linux/amd64,linux/arm64 |
| 149 | + tags: ${{ steps.tags.outputs.tags }} |
| 150 | + labels: | |
| 151 | + org.opencontainers.image.source=https://github.com/${{ github.repository }} |
| 152 | + org.opencontainers.image.revision=${{ github.sha }} |
| 153 | + org.opencontainers.image.created=${{ github.event.head_commit.timestamp }} |
| 154 | + cache-from: type=gha,scope=dashboard |
| 155 | + cache-to: type=gha,mode=max,scope=dashboard |
0 commit comments