-
Notifications
You must be signed in to change notification settings - Fork 2
77 lines (74 loc) · 2.55 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
76
77
name: Build & Deploy
on:
push:
branches: [ main ]
release:
types:
- created
workflow_dispatch:
jobs:
build:
name: create base image
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
DOCKER_REPO: wradlib-docker
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: set release-tag env var
run: |
echo "WRADLIB_VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
echo "fetch_status=`docker pull wradlib/${DOCKER_REPO}:base > /dev/null && echo 1 || echo 0`" >> $GITHUB_ENV
- name: check release-tag
run: |
echo wradlib_version "$WRADLIB_VERSION"
echo wradlib_version2 "$GITHUB_REF"
echo fetch_status "$fetch_status"
- name: build base image
env:
DOCKER_ID: ${{ secrets.DOCKER_ID }}
DOCKER_PW: ${{ secrets.DOCKER_PW }}
run: |
cd base
if [ "${fetch_status}" == "0" ]; then
docker build -t wradlib/$DOCKER_REPO:base .
docker images
echo "$DOCKER_PW" | docker login -u $DOCKER_ID --password-stdin
docker push wradlib/$DOCKER_REPO:base
fi
- name: add env vars
run: |
if [ "${WRADLIB_VERSION}" == "" ]; then
echo "WRADLIB_VERSION=main" >> $GITHUB_ENV
fi
echo "WRADLIB_DOCKER_TAG=min" >> $GITHUB_ENV
- name: build min image
env:
DOCKER_ID: ${{ secrets.DOCKER_ID }}
DOCKER_PW: ${{ secrets.DOCKER_PW }}
run: |
docker build --build-arg WRADLIB_VERSION --build-arg WRADLIB_DOCKER_TAG --build-arg DOCKER_REPO -t wradlib/$DOCKER_REPO:$WRADLIB_VERSION-${WRADLIB_DOCKER_TAG} .
docker images
echo "$DOCKER_PW" | docker login -u $DOCKER_ID --password-stdin
docker push wradlib/$DOCKER_REPO:$WRADLIB_VERSION-${WRADLIB_DOCKER_TAG}
- name: add env vars
run: |
if [ "${WRADLIB_VERSION}" == "" ]; then
echo "WRADLIB_VERSION=main" >> $GITHUB_ENV
fi
echo "WRADLIB_DOCKER_TAG=full" >> $GITHUB_ENV
- name: build full image
env:
DOCKER_ID: ${{ secrets.DOCKER_ID }}
DOCKER_PW: ${{ secrets.DOCKER_PW }}
run: |
docker build --build-arg WRADLIB_VERSION --build-arg WRADLIB_DOCKER_TAG --build-arg DOCKER_REPO -t wradlib/$DOCKER_REPO:$WRADLIB_VERSION-${WRADLIB_DOCKER_TAG} .
docker images
echo "$DOCKER_PW" | docker login -u $DOCKER_ID --password-stdin
docker push wradlib/$DOCKER_REPO:$WRADLIB_VERSION-${WRADLIB_DOCKER_TAG}