Skip to content

Commit

Permalink
include tag
Browse files Browse the repository at this point in the history
  • Loading branch information
randygrok committed Jul 8, 2024
1 parent 7a3011c commit 403073b
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 45 deletions.
92 changes: 49 additions & 43 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,53 +12,59 @@ jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/NillionNetwork/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=tag
flavor: |
latest=false # Ensure 'latest' tag is not generated
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/NillionNetwork/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=tag
flavor: |
latest=false # Ensure 'latest' tag is not generated
- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
- name: Set VERSION environment variable
run: |
# Extract the first tag from the generated tags
TAG=$(echo ${{ steps.meta.outputs.tags }} | cut -d ',' -f 1)
echo "VERSION=$TAG" >> $GITHUB_ENV
- name: Debug tags
run: |
echo "Generated tags: ${{ steps.meta.outputs.tags }}"
echo "Generated labels: ${{ steps.meta.outputs.labels }}"
- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
tags: ${{ steps.meta.outputs.tags }}

- name: List Docker images
run: docker images
- name: Debug tags
run: |
echo "Generated tags: ${{ steps.meta.outputs.tags }}"
echo "Generated labels: ${{ steps.meta.outputs.labels }}"
- name: Test nilchaind is runnable
run: |
# Extract the tag from the current context
TAG=$(echo ${{ steps.meta.outputs.tags }} | cut -d ',' -f 1)
echo "Running Docker container with tag: $TAG"
docker run --rm $TAG version
- name: List Docker images
run: docker images

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Test nilchaind is runnable
run: |
# Extract the tag from the current context
TAG=$(echo ${{ steps.meta.outputs.tags }} | cut -d ',' -f 1)
echo "Running Docker container with tag: $TAG"
docker run --rm $TAG version
- name: Push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ ADD nilchaind nilchaind
ADD params params
ADD x x

ADD .git .git
ARG VERSION
ENV VERSION=${VERSION}

COPY Makefile .
COPY go.mod .
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/make -f

VERSION := $(shell echo $(shell git describe --always) | sed 's/^v//')
ifndef VERSION
VERSION := $(shell echo $(shell git describe --always) | sed 's/^v//')
endif

export TMVERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::')
export COMMIT := $(shell git log -1 --format='%H')

Expand Down

0 comments on commit 403073b

Please sign in to comment.