Fix vector DB API endpoint - change /api/vector-dbs to /api/vector-db… #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Publish Chef UI Image to GHCR | |
| on: | |
| push: | |
| branches: [ main, chef ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| REGISTRY: ghcr.io | |
| ORG: x2ansible | |
| IMAGE_NAME: x2a-ui-chef # 👈 Chef-specific UI image name | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Podman and gh CLI | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install podman gh | |
| - name: Generate version tags | |
| id: version | |
| run: | | |
| DATE_TAG=$(date +'%Y.%m.%d') | |
| SHORT_SHA=${GITHUB_SHA:0:7} | |
| BUILD_NUMBER=$(git rev-list --count HEAD) | |
| SEMANTIC_VERSION="${DATE_TAG}.${BUILD_NUMBER}" | |
| TIMESTAMP=$(date +'%Y%m%d-%H%M%S') | |
| # Add branch-specific tag if not on main | |
| if [ "${{ github.ref_name }}" != "main" ]; then | |
| BRANCH_TAG="${{ github.ref_name }}" | |
| echo "BRANCH_TAG=${BRANCH_TAG}" >> $GITHUB_OUTPUT | |
| fi | |
| echo "DATE_TAG=${DATE_TAG}" >> $GITHUB_OUTPUT | |
| echo "SHORT_SHA=${SHORT_SHA}" >> $GITHUB_OUTPUT | |
| echo "BUILD_NUMBER=${BUILD_NUMBER}" >> $GITHUB_OUTPUT | |
| echo "SEMANTIC_VERSION=${SEMANTIC_VERSION}" >> $GITHUB_OUTPUT | |
| echo "TIMESTAMP=${TIMESTAMP}" >> $GITHUB_OUTPUT | |
| - name: Login to GHCR | |
| env: | |
| CR_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| echo "${CR_PAT}" | podman login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin | |
| - name: Build image and tag | |
| run: | | |
| # Base tags for all builds | |
| TAGS="-t ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:latest" | |
| TAGS="$TAGS -t ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.SEMANTIC_VERSION }}" | |
| TAGS="$TAGS -t ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.DATE_TAG }}" | |
| TAGS="$TAGS -t ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.SHORT_SHA }}" | |
| TAGS="$TAGS -t ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:build-${{ steps.version.outputs.BUILD_NUMBER }}" | |
| # Add branch-specific tag if not on main | |
| if [ "${{ github.ref_name }}" != "main" ]; then | |
| TAGS="$TAGS -t ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}" | |
| fi | |
| podman build \ | |
| --label "org.opencontainers.image.source=https://github.com/${{ github.repository }}" \ | |
| --label "org.opencontainers.image.description=Chef-specific UI frontend for x2ansible" \ | |
| --label "org.opencontainers.image.url=https://github.com/${{ github.repository }}" \ | |
| --label "org.opencontainers.image.documentation=https://github.com/${{ github.repository }}" \ | |
| --label "org.opencontainers.image.version=${{ steps.version.outputs.SEMANTIC_VERSION }}" \ | |
| --label "org.opencontainers.image.revision=${{ github.sha }}" \ | |
| --label "org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ | |
| --label "org.opencontainers.image.licenses=MIT" \ | |
| --label "org.opencontainers.image.vendor=${{ env.ORG }}" \ | |
| --label "org.opencontainers.image.title=${{ env.IMAGE_NAME }}" \ | |
| --label "org.opencontainers.image.ref.name=${{ github.ref_name }}" \ | |
| $TAGS \ | |
| -f Containerfile . | |
| - name: Push all image tags | |
| run: | | |
| podman push ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:latest | |
| podman push ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.SEMANTIC_VERSION }} | |
| podman push ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.DATE_TAG }} | |
| podman push ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.SHORT_SHA }} | |
| podman push ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:build-${{ steps.version.outputs.BUILD_NUMBER }} | |
| # Push branch-specific tag if not on main | |
| if [ "${{ github.ref_name }}" != "main" ]; then | |
| podman push ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} | |
| fi | |
| - name: Final info & usage summary | |
| run: | | |
| echo "🔗 Make image public: https://github.com/orgs/${{ env.ORG }}/packages/container/${{ env.IMAGE_NAME }}/settings" | |
| echo "🌿 Branch: ${{ github.ref_name }}" | |
| echo "📦 Image: ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}" | |
| echo "" | |
| echo "📥 Pull commands:" | |
| echo "podman pull ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:latest" | |
| echo "podman pull ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.SEMANTIC_VERSION }}" | |
| echo "podman pull ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.DATE_TAG }}" | |
| echo "podman pull ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.SHORT_SHA }}" | |
| echo "podman pull ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:build-${{ steps.version.outputs.BUILD_NUMBER }}" | |
| if [ "${{ github.ref_name }}" != "main" ]; then | |
| echo "podman pull ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}" | |
| fi | |
| - name: Test public pull (optional) | |
| continue-on-error: true | |
| run: | | |
| podman logout ${{ env.REGISTRY }} || true | |
| podman pull ${{ env.REGISTRY }}/${{ env.ORG }}/${{ env.IMAGE_NAME }}:latest || echo "If this fails, set visibility to public in GHCR package settings." |