Skip to content

Commit 14a22cf

Browse files
authored
Merge pull request #415 from vprashar2929/add-rel-wk
feat(ci): Add a release workflow for Model Server
2 parents 3a1987a + 79ef2cc commit 14a22cf

File tree

3 files changed

+123
-4
lines changed

3 files changed

+123
-4
lines changed

.github/workflows/release.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
tag:
6+
description: "Tag name, e.g. 0.7.11"
7+
default: ""
8+
required: true
9+
10+
jobs:
11+
build:
12+
name: Upload Release Asset
13+
permissions:
14+
contents: write
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
20+
- name: Login to Quay.io
21+
uses: docker/login-action@v2
22+
with:
23+
registry: ${{ vars.IMAGE_REGISTRY }}
24+
username: ${{ secrets.docker_username }}
25+
password: ${{ secrets.docker_password }}
26+
27+
- name: Git set user
28+
shell: bash
29+
run: |
30+
git config user.name "$USERNAME"
31+
git config user.email "[email protected]"
32+
env:
33+
USERNAME: ${{ github.actor }}
34+
35+
- name: Update the VERSION
36+
run: |
37+
echo "$VERSION" > VERSION
38+
env:
39+
VERSION: ${{ github.event.inputs.tag }}
40+
41+
- name: Build model-server-base
42+
run: |
43+
make build-base
44+
env:
45+
IMAGE_REGISTRY: ${{ vars.IMAGE_REGISTRY }}
46+
47+
- name: Push model-server-base
48+
run: |
49+
make push-base
50+
env:
51+
IMAGE_REGISTRY: ${{ vars.IMAGE_REGISTRY }}
52+
53+
- name: Update base in model-server dockerfile
54+
run: |
55+
sed -i "s/model_server_base:.*/model_server_base:v$VERSION/g" ./dockerfiles/Dockerfile
56+
env:
57+
VERSION: ${{ github.event.inputs.tag }}
58+
59+
- name: Build model-server
60+
run: |
61+
make build
62+
env:
63+
IMAGE_REGISTRY: ${{ vars.IMAGE_REGISTRY }}
64+
65+
- name: Create tag
66+
run: |
67+
git add VERSION ./dockerfiles/Dockerfile
68+
git commit -m "ci: update VERSION to $VERSION"
69+
git tag -a "v$VERSION" -m "$VERSION"
70+
git show --stat
71+
env:
72+
VERSION: ${{ github.event.inputs.tag }}
73+
74+
- name: Push Images
75+
run: |
76+
make push
77+
env:
78+
IMAGE_REGISTRY: ${{ vars.IMAGE_REGISTRY }}
79+
80+
- name: Push Release tag
81+
run: |
82+
git push --follow-tags
83+
84+
- name: Create Release
85+
id: create_release
86+
uses: actions/create-release@v1
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
with:
90+
tag_name: "v${{ github.event.inputs.tag }}"
91+
release_name: "v${{ github.event.inputs.tag }}-release"
92+
draft: false
93+
prerelease: false
94+
95+
create-release-branch:
96+
name: Create Release Branch
97+
permissions:
98+
contents: write
99+
needs: build
100+
runs-on: ubuntu-latest
101+
steps:
102+
- name: Create release branch
103+
uses: peterjgrainger/[email protected]
104+
env:
105+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106+
with:
107+
branch: "v${{ github.event.inputs.tag }}-release"
108+
sha: "${{ github.event.pull_request.head.sha }}"

Makefile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,45 @@
1-
export IMAGE_REGISTRY ?= quay.io/sustainable_computing_io
1+
IMAGE_REGISTRY ?= quay.io/sustainable_computing_io
22
IMAGE_NAME := kepler_model_server
3-
IMAGE_VERSION := latest
3+
IMAGE_VERSION ?= v$(shell cat VERSION)
44
KEPLER_IMAGE_NAME := kepler
5-
KEPLER_IMAGE_VERSION := release-0.7.11
5+
KEPLER_IMAGE_VERSION ?= release-0.7.11
66

77
IMAGE ?= $(IMAGE_REGISTRY)/$(IMAGE_NAME):$(IMAGE_VERSION)
88
KEPLER_IMAGE ?= $(IMAGE_REGISTRY)/$(KEPLER_IMAGE_NAME):$(KEPLER_IMAGE_VERSION)
99
BASE_IMAGE ?= $(IMAGE_REGISTRY)/$(IMAGE_NAME)_base:$(IMAGE_VERSION)
1010
TEST_IMAGE := $(IMAGE)-test
1111

1212
CTR_CMD ?= docker
13-
PYTHON = python3.10
13+
PYTHON := python3.10
1414

1515
DOCKERFILES_PATH := ./dockerfiles
1616
MODEL_PATH := ${PWD}/tests/models
1717

18+
.PHONY: build
1819
build:
1920
$(CTR_CMD) build -t $(IMAGE) -f $(DOCKERFILES_PATH)/Dockerfile .
2021

22+
.PHONY: build-base
2123
build-base:
2224
$(CTR_CMD) build -t $(BASE_IMAGE) -f $(DOCKERFILES_PATH)/Dockerfile.base .
2325

26+
.PHONY: build-test-nobase
2427
build-test-nobase:
2528
$(CTR_CMD) build -t $(TEST_IMAGE) -f $(DOCKERFILES_PATH)/Dockerfile.test-nobase .
2629

30+
.PHONY: build-test
2731
build-test:
2832
$(CTR_CMD) build -t $(TEST_IMAGE) -f $(DOCKERFILES_PATH)/Dockerfile.test .
2933

34+
.PHONY: push
3035
push:
3136
$(CTR_CMD) push $(IMAGE)
3237

38+
.PHONY: push-base
39+
push-base:
40+
$(CTR_CMD) push $(BASE_IMAGE)
41+
42+
.PHONY: push-test
3343
push-test:
3444
$(CTR_CMD) push $(TEST_IMAGE)
3545

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.7.11-2

0 commit comments

Comments
 (0)