-
Notifications
You must be signed in to change notification settings - Fork 19
63 lines (57 loc) · 1.77 KB
/
build-images.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
name: Build Images
on:
pull_request:
branches:
- master
push:
branches:
- master
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
jobs:
build-images:
name: "VPP ${{ matrix.tag }}"
runs-on: ubuntu-latest
env:
DOCKER_REPO: ligato/vpp-base
REPO: ${{ matrix.repo }}
TAG: ${{ matrix.tag }}
strategy:
fail-fast: false
matrix:
tag: ['master', 'latest', '24.06', '24.02', '23.10', '23.06']
include:
- tag: 'master'
repo: 'master'
- tag: 'latest'
repo: 'release'
- tag: '24.06'
repo: '2406'
- tag: '24.02'
repo: '2402'
- tag: '23.10'
repo: '2310'
- tag: '23.06'
repo: '2306'
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Build image"
run: |
env | sort
docker build --build-arg REPO="$REPO" --tag "$DOCKER_REPO:$TAG" .
docker run --rm "$DOCKER_REPO:$TAG" dpkg-query -f '${Version}' -W vpp
- name: "Publish image"
if: github.event_name != 'pull_request'
run: |
export VPP_VERSION=$(docker run --rm "$DOCKER_REPO:$TAG" cat /vpp/version | cut -d'~' -f1,2 | sed -e 's/~/./g')
docker tag "$DOCKER_REPO:$TAG" "$DOCKER_REPO:$VPP_VERSION"
docker images "$DOCKER_REPO"
if [ $GITHUB_EVENT_NAME == "schedule" ] && curl -sSflL "https://index.docker.io/v1/repositories/$DOCKER_REPO/tags/$VPP_VERSION" >/dev/null; then
echo "Image $DOCKER_REPO:$VPP_VERSION has already been published."
else
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker push "$DOCKER_REPO:$VPP_VERSION"
docker push "$DOCKER_REPO:$TAG"
fi