-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (65 loc) · 2.33 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: CI
on: [push]
jobs:
build:
strategy:
matrix:
app:
- cronut
- duply
- events-relay
- helm
- kubectl
- netdebug
- nginx-proxy
- puppeteer
- s3-proxy
- sbt
- slurm-docker-cluster
- wklink
- om-bistro
- metrics-pusher
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build docker images
working-directory: ${{ matrix.app }}
run: |
export CI_BRANCH=$(git rev-parse --abbrev-ref HEAD)
export NORMALIZED_CI_BRANCH=${CI_BRANCH//[\/-]/_}
docker build \
-t scalableminds/${{ matrix.app }} \
-t scalableminds/${{ matrix.app }}:${NORMALIZED_CI_BRANCH}__${GITHUB_RUN_ID} \
-t scalableminds/${{ matrix.app }}:${NORMALIZED_CI_BRANCH} \
.
- name: Run tests
working-directory: ${{ matrix.app }}
run: |
if [ -f test.sh ]; then
./test.sh
fi
- name: Push docker images
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
run: |
export CI_BRANCH=$(git rev-parse --abbrev-ref HEAD)
export NORMALIZED_CI_BRANCH=${CI_BRANCH//[\/-]/_}
does_repo_exist() {
curl --silent -f -lSL https://hub.docker.com/v2/namespaces/scalableminds/repositories/$1/tags > /dev/null
}
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
if does_repo_exist ${{ matrix.app }}; then
docker push scalableminds/${{ matrix.app }}:${NORMALIZED_CI_BRANCH}__${GITHUB_RUN_ID}
docker push scalableminds/${{ matrix.app }}:${NORMALIZED_CI_BRANCH}
else
docker tag \
scalableminds/${{ matrix.app }}:${NORMALIZED_CI_BRANCH}__${GITHUB_RUN_ID} \
scalableminds/various:${{ matrix.app }}__${NORMALIZED_CI_BRANCH}__${GITHUB_RUN_ID}
docker push scalableminds/various:${{ matrix.app }}__${NORMALIZED_CI_BRANCH}__${GITHUB_RUN_ID}
docker tag \
scalableminds/${{ matrix.app }}:${NORMALIZED_CI_BRANCH} \
scalableminds/various:${{ matrix.app }}__${NORMALIZED_CI_BRANCH}
docker push scalableminds/various:${{ matrix.app }}__${NORMALIZED_CI_BRANCH}
fi
docker logout