-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (63 loc) · 1.98 KB
/
build.yaml
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
name: CI build of all containers
on:
push:
branches:
- main
tags:
- v*
pull_request:
env:
ENQUEUE_NAME: embargo-butler-enqueue
INGEST_NAME: embargo-butler-ingest
IDLE_NAME: embargo-butler-idle
jobs:
push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build enqueue image
run: |
docker build . \
-f Dockerfile.enqueue \
--tag $ENQUEUE_NAME \
--label "runnumber=${GITHUB_RUN_ID}"
- name: Build ingest image
run: |
docker build . \
-f Dockerfile.ingest \
--tag $INGEST_NAME \
--label "runnumber=${GITHUB_RUN_ID}"
- name: Build idle image
run: |
docker build . \
-f Dockerfile.idle \
--tag $IDLE_NAME \
--label "runnumber=${GITHUB_RUN_ID}"
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Push images
run: |
ENQUEUE_ID=ghcr.io/${{ github.repository_owner }}/$ENQUEUE_NAME
INGEST_ID=ghcr.io/${{ github.repository_owner }}/$INGEST_NAME
IDLE_ID=ghcr.io/${{ github.repository_owner }}/$IDLE_NAME
if [[ "${{ github.ref }}" == "refs/pull/"* ]]; then
VERSION=$(echo "${{ github.head_ref }}" | sed -e 's|.*/||')
elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
VERSION=$(echo "${{ github.ref_name }}" | sed -e 's|^v||')
else
VERSION=latest
fi
echo ENQUEUE_ID=$ENQUEUE_ID
echo INGEST_ID=$INGEST_ID
echo IDLE_ID=$IDLE_ID
echo VERSION=$VERSION
docker tag $ENQUEUE_NAME $ENQUEUE_ID:$VERSION
docker push $ENQUEUE_ID:$VERSION
docker tag $INGEST_NAME $INGEST_ID:$VERSION
docker push $INGEST_ID:$VERSION
docker tag $IDLE_NAME $IDLE_ID:$VERSION
docker push $IDLE_ID:$VERSION