forked from forbole/callisto
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (66 loc) · 2.22 KB
/
docker-build.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: docker-build
on:
push:
branches:
- cosmos/*/*
- chains/*/*
permissions:
contents: read
packages: write
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set BDJuno chain name 🔧
shell: bash
run: echo "CHAIN_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_ENV
- name: Set BDJuno version 🔧
shell: bash
run: echo "GITHUB_VERSION=$(git describe --tags)" >> $GITHUB_ENV
- name: Docker metadata ${{ matrix.image }}
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/${{ env.CHAIN_NAME }}
tags: |
type=raw,value=latest
type=raw,value=${{ env.GITHUB_VERSION }}
type=semver,pattern=v{{version}}
# - name: Prepare tags 🏷️
# id: prep
# run: |
# DOCKER_IMAGE=${{ secrets.DOCKERHUB_BDJUNO_REPO }}
# CHAIN_NAME="${{env.CHAIN_NAME}}"
# VERSION="${{env.GITHUB_VERSION}}"
# TAGS="${DOCKER_IMAGE}:${CHAIN_NAME}-${VERSION}"
# echo ::set-output name=version::${VERSION}
# echo ::set-output name=tags::${TAGS}
# echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Determine Dockerfile to use 🔍
run: |
if [[ -f Dockerfile.cosmwasm ]]; then
export DOCKERFILE=Dockerfile.cosmwasm
else
export DOCKERFILE=Dockerfile.default
fi
echo "DOCKERFILE=${DOCKERFILE}" >> $GITHUB_ENV
- name: Set up Docker Buildx 🧰
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push 📤
uses: docker/build-push-action@v5
with:
context: .
file: "./${{ env.DOCKERFILE }}"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}