@@ -33,44 +33,46 @@ jobs:
33
33
username : ${{ github.actor }}
34
34
password : ${{ secrets.GITHUB_TOKEN }}
35
35
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
41
38
42
39
- 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
51
51
52
52
- name : Update YAML in other repository
53
53
env :
54
54
PAT : ${{ secrets.PAT_FOR_PRIVATE_REPO }}
55
55
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
58
57
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
66
66
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
71
72
fi
72
73
done
73
74
75
+ cd ops-setup
74
76
git config user.name github-actions
75
77
git config user.email github-actions@github.com
76
78
git add .
0 commit comments