-
Notifications
You must be signed in to change notification settings - Fork 6
49 lines (42 loc) · 1.59 KB
/
build-docker-image.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
name: Build Docker Image
on:
workflow_dispatch:
push:
branches:
- devnet
- testnet
- stagenet
- mainnet
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- run: docker login --username atletanetwork --password ${{ secrets.REGISTRYPASS }} docker.io
- name: Detect build features
id: features
run: |
case ${{ github.ref_name }} in
mainnet)
echo "build_features=mainnet-runtime" >> "$GITHUB_OUTPUT" ;;
stagenet)
echo "build_features=mainnet-runtime" >> "$GITHUB_OUTPUT" ;;
testnet)
echo "build_features=testnet-runtime" >> "$GITHUB_OUTPUT" ;;
devnet)
echo "build_features=devnet-runtime" >> "$GITHUB_OUTPUT" ;;
*)
echo "Unable to detect build features for '${{ github.ref_name }}'"
exit 1 ;;
esac
- name: Build and Push Docker Image
env:
build_features: ${{ steps.features.outputs.build_features }}
image_tag: ${{ github.ref_name }}
run: |
TIMESTAMP=$(date +%d%m%y-%H%M%S)
docker build --build-arg BUILD_FEATURES=${build_features} --tag docker.io/atletanetwork/atleta-node:${image_tag}-${TIMESTAMP} .
docker tag docker.io/atletanetwork/atleta-node:${image_tag}-${TIMESTAMP} docker.io/atletanetwork/atleta-node:${image_tag}-latest
docker push docker.io/atletanetwork/atleta-node:${image_tag}-${TIMESTAMP}
docker push docker.io/atletanetwork/atleta-node:${image_tag}-latest