Skip to content

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pschork committed May 31, 2024
1 parent 0473cfc commit ee81880
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/docker-publish-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: docker-publish-release

on:
push:
branches:
- release/*
pull_request:
workflow_dispatch:

env:
REGISTRY: ghcr.io
CACHE-FROM: /tmp/.buildx-cache
CACHE-TO: /tmp/.buildx-cache-new

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

- name: Determine SemVer
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true

- run: |
echo "SemVer ${{ env.semVer }} FullSemVer ${{ env.fullSemVer }}"
name: Display SemVer
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
with:
install: true
driver-opts: image=moby/buildkit:master

- name: Cache docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
if: ${{ success() }}

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: ${{ success() }}

# Build And Push Image
- name: Build docker image release
run: make docker-release-build
if: ${{ success() }}

- name: Push docker image release
run: make docker-release-push
if: ${{ success() }}
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
.PHONY: compile-el compile-dl clean protoc lint build unit-tests integration-tests-churner integration-tests-indexer integration-tests-inabox integration-tests-inabox-nochurner integration-tests-graph-indexer

ifeq ($(wildcard .git/*),)
$(warning semver disabled - building from release zip)
GITCOMMIT := ""
GITDATE := ""
SEMVER := $(shell basename $(CURDIR))
else
GITCOMMIT := $(shell git rev-parse --short HEAD)
GITDATE := $(shell git log -1 --format=%cd --date=unix)
SEMVER := $(shell docker run --rm --volume "$(PWD):/repo" gittools/gitversion:5.12.0 /repo -output json -showvariable SemVer)
ifeq ($(SEMVER), )
$(warning semver disabled - docker not installed)
SEMVER := "0.0.0"
endif
endif

RELEASE_TAG := $(or $(RELEASE_TAG),latest)

PROTOS := ./api/proto
PROTOS_DISPERSER := ./disperser/api/proto
PROTO_GEN := ./api/grpc
Expand Down Expand Up @@ -75,3 +92,12 @@ integration-tests-graph-indexer:
integration-tests-dataapi:
make dataapi-build
go test -v ./disperser/dataapi

docker-release-build:
RELEASE_TAG=${SEMVER} docker compose -f docker-compose-release.yaml build --build-arg SEMVER=${SEMVER} --build-arg GITCOMMIT=${GITCOMMIT} --build-arg GITDATE=${GITDATE}

docker-release-push:
RELEASE_TAG=${SEMVER} docker compose -f docker-compose-release.yaml push

semver:
echo "${SEMVER}"
12 changes: 12 additions & 0 deletions docker-compose-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is used for building and pushing images
services:
node:
build:
context: .
dockerfile: node/cmd/Dockerfile
image: ghcr.io/layr-labs/eigenda/node:${RELEASE_TAG}
nodeplugin:
build:
context: .
dockerfile: node/plugin/cmd/Dockerfile
image: ghcr.io/layr-labs/eigenda/nodeplugin:${RELEASE_TAG}

0 comments on commit ee81880

Please sign in to comment.