-
Notifications
You must be signed in to change notification settings - Fork 14
71 lines (64 loc) · 2.07 KB
/
release-backend.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
name: Release CCDScan Backend
on:
push:
tags:
- ccdscan-backend/*
jobs:
release-docker:
runs-on: ubuntu-latest
environment: release
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: 'concordium'
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Clone repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set image tag if correctly formatted
env:
TAG: ${{ github.ref_name }}
run: |
TAG_VERSION=${TAG##ccdscan-backend/}
EXPECTED=$(yq .package.version backend-rust/Cargo.toml)
EXTRACTED="$TAG_VERSION"
if [ ! "$EXPECTED" = "$EXTRACTED" ] ; then
echo "::error::$EXPECTED does not match $EXTRACTED."
exit 1
fi
echo "TAG_VERSION=${TAG_VERSION}" >> $GITHUB_ENV
- name: Check if images exists
run: |
set +e
docker manifest inspect concordium/ccdscan-indexer:$TAG_VERSION
EXITCODE=$?
if [ $EXITCODE -eq "0" ]; then
echo "::error::concordium/ccdscan-indexer:$TAG_VERSION already exists."
exit 1
fi
docker manifest inspect concordium/ccdscan-api:$TAG_VERSION
EXITCODE=$?
if [ $EXITCODE -eq "0" ]; then
echo "::error::concordium/ccdscan-api:$TAG_VERSION already exists."
exit 1
fi
- name: Build indexer docker image
uses: docker/build-push-action@v6
with:
context: backend-rust
file: backend-rust/Dockerfile
tags: concordium/ccdscan-indexer:${{ env.TAG_VERSION }}
push: true
build-args: |
target_binary=ccdscan-indexer
- name: Build api docker image
uses: docker/build-push-action@v6
with:
context: backend-rust
file: backend-rust/Dockerfile
tags: concordium/ccdscan-api:${{ env.TAG_VERSION }}
push: true
build-args: |
target_binary=ccdscan-api