|
10 | 10 | find-images: |
11 | 11 | runs-on: ubuntu-latest |
12 | 12 | outputs: |
13 | | - images: ${{ steps.set-images.outputs.images }} |
14 | 13 | base-version: ${{ steps.get-versions.outputs.base-version }} |
15 | 14 | python-versions: ${{ steps.get-versions.outputs.python-versions }} |
16 | 15 | default-python: ${{ steps.get-versions.outputs.default-python }} |
|
31 | 30 | echo "base-version=$BASE_VERSION" >> $GITHUB_OUTPUT |
32 | 31 | echo "python-versions=$PYTHON_VERSIONS" >> $GITHUB_OUTPUT |
33 | 32 | echo "default-python=$DEFAULT_PYTHON" >> $GITHUB_OUTPUT |
34 | | -
|
35 | | - - id: set-images |
36 | | - run: | |
37 | | - IMAGES=$(find pipecat-starters -name Dockerfile -exec dirname {} \; | jq -R -s -c 'split("\n")[:-1]') |
38 | | - echo "images=$IMAGES" >> $GITHUB_OUTPUT |
39 | 33 | build-base: |
40 | 34 | runs-on: ubuntu-24.04-arm |
41 | 35 | name: Build Base Images |
|
79 | 73 | build-args: | |
80 | 74 | VERSION=${{ needs.find-images.outputs.base-version }} |
81 | 75 | PYTHON_VERSION=${{ matrix.python-version }} |
82 | | -
|
83 | | - build-starters: |
84 | | - needs: |
85 | | - - find-images |
86 | | - - build-base |
87 | | - strategy: |
88 | | - matrix: |
89 | | - image: ${{ fromJson(needs.find-images.outputs.images) }} |
90 | | - runs-on: ubuntu-24.04-arm |
91 | | - name: Build ${{ matrix.image }} |
92 | | - |
93 | | - steps: |
94 | | - - name: Checkout repository |
95 | | - uses: actions/checkout@v4 |
96 | | - |
97 | | - - name: Get starter version |
98 | | - id: get-starter-version |
99 | | - run: | |
100 | | - IMAGE_LOCATION=${{ matrix.image }} |
101 | | - STARTER_NAME=$(basename ${IMAGE_LOCATION}) |
102 | | - STARTER_VERSION=$(yq ".starters.${STARTER_NAME}" versions.yaml) |
103 | | -
|
104 | | - if [ "$STARTER_VERSION" = "null" ]; then |
105 | | - echo "Error: No version found for starter '${STARTER_NAME}' in versions.yaml" |
106 | | - exit 1 |
107 | | - fi |
108 | | -
|
109 | | - if ! [[ $STARTER_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
110 | | - echo "Invalid version format for starter '${STARTER_NAME}' in versions.yaml: $STARTER_VERSION" |
111 | | - exit 1 |
112 | | - fi |
113 | | -
|
114 | | - echo "starter-version=$STARTER_VERSION" >> $GITHUB_OUTPUT |
115 | | -
|
116 | | - - name: Create image name |
117 | | - id: createImageName |
118 | | - run: | |
119 | | - IMAGE_LOCATION=${{ matrix.image }} |
120 | | - IMAGE_NAME=$(echo ${IMAGE_LOCATION} | tr '/' '-') |
121 | | - echo "imageName=${IMAGE_NAME}" >> $GITHUB_OUTPUT |
122 | | -
|
123 | | - - name: Log in to Docker Hub |
124 | | - if: github.event_name != 'pull_request' |
125 | | - uses: docker/login-action@v3 |
126 | | - with: |
127 | | - username: ${{ secrets.DOCKER_USERNAME }} |
128 | | - password: ${{ secrets.DOCKER_PAT }} |
129 | | - |
130 | | - - name: Extract Docker metadata |
131 | | - id: meta |
132 | | - uses: docker/metadata-action@v5 |
133 | | - with: |
134 | | - images: dailyco/${{ steps.createImageName.outputs.imageName }} |
135 | | - tags: | |
136 | | - type=raw,value=latest |
137 | | - type=raw,value=${{ steps.get-starter-version.outputs.starter-version }} |
138 | | -
|
139 | | - - name: Set up Docker Buildx |
140 | | - uses: docker/setup-buildx-action@v3 |
141 | | - |
142 | | - - name: Build and push |
143 | | - uses: docker/build-push-action@v5 |
144 | | - with: |
145 | | - context: ./${{ matrix.image }} |
146 | | - platforms: linux/arm64 |
147 | | - push: ${{ github.event_name != 'pull_request' }} |
148 | | - tags: ${{ steps.meta.outputs.tags }} |
149 | | - labels: ${{ steps.meta.outputs.labels }} |
0 commit comments