Skip to content

Commit f7c697c

Browse files
pipeline fix
1 parent 39c7d9c commit f7c697c

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

.github/workflows/build-and-deploy.yaml

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,44 +33,46 @@ jobs:
3333
username: ${{ github.actor }}
3434
password: ${{ secrets.GITHUB_TOKEN }}
3535

36-
- name: Find directories with Dockerfiles
37-
id: find_dirs
38-
run: |
39-
dirs=$(find . -maxdepth 2 -name Dockerfile -exec dirname {} \; | sed 's|^\./||' | jq -R -s -c 'split("\n")[:-1]')
40-
echo "directories=$dirs" >> $GITHUB_OUTPUT
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@v2
4138

4239
- name: Build and push Docker images
43-
uses: docker/build-push-action@v4
44-
strategy:
45-
matrix:
46-
directory: ${{ fromJson(steps.find_dirs.outputs.directories) }}
47-
with:
48-
context: ${{ matrix.directory }}
49-
push: true
50-
tags: ${{ env.REGISTRY }}/${{ env.ORGANIZATION }}/${{ matrix.directory }}:${{ github.sha }}
40+
run: |
41+
for dir in */; do
42+
if [ -f "${dir}Dockerfile" ]; then
43+
dir_name=$(basename "$dir")
44+
echo "Building and pushing image for $dir_name"
45+
docker buildx build \
46+
--push \
47+
--tag ${{ env.REGISTRY }}/${{ env.ORGANIZATION }}/${dir_name}:${{ github.sha }} \
48+
${dir}
49+
fi
50+
done
5151
5252
- name: Update YAML in other repository
5353
env:
5454
PAT: ${{ secrets.PAT_FOR_PRIVATE_REPO }}
5555
run: |
56-
git clone https://${PAT}@github.com/your-org/your-private-repo.git
57-
cd your-private-repo
56+
git clone https://${PAT}@github.com/opentensor/ops-setup.git
5857
59-
# Loop through each directory and update the corresponding YAML file
60-
for dir in ${{ join(fromJson(steps.find_dirs.outputs.directories), ' ') }}; do
61-
if [ "${{ github.event.inputs.environment }}" == "finney" ]; then
62-
yaml_file="clusters/data-wearhouse-finney/indexers/${dir}.yaml"
63-
elif [ "${{ github.event.inputs.environment }}" == "testnet" ]; then
64-
yaml_file="clusters/data-wearhouse-testnet/indexers/${dir}.yaml"
65-
fi
58+
for dir in */; do
59+
if [ -f "${dir}Dockerfile" ]; then
60+
dir_name=$(basename "$dir")
61+
if [ "${{ github.event.inputs.environment }}" == "finney" ]; then
62+
yaml_file="ops-setup/clusters/data-wearhouse-finney/indexers/${dir}.yaml"
63+
elif [ "${{ github.event.inputs.environment }}" == "testnet" ]; then
64+
yaml_file="ops-setup/clusters/data-wearhouse-testnet/indexers/${dir}.yaml"
65+
fi
6666
67-
if [ -f "$yaml_file" ]; then
68-
sed -i 's|image: .*|image: ${{ env.REGISTRY }}/${{ env.ORGANIZATION }}/'${dir}':${{ github.sha }}|' "$yaml_file"
69-
else
70-
echo "Warning: $yaml_file not found"
67+
if [ -f "$yaml_file" ]; then
68+
sed -i 's|image: .*|image: ${{ env.REGISTRY }}/${{ env.ORGANIZATION }}/'${dir}':${{ github.sha }}|' "$yaml_file"
69+
else
70+
echo "Warning: $yaml_file not found"
71+
fi
7172
fi
7273
done
7374
75+
cd ops-setup
7476
git config user.name github-actions
7577
git config user.email github-actions@github.com
7678
git add .

0 commit comments

Comments
 (0)