Skip to content

Commit

Permalink
Merge pull request #29 from kimwnasptd/feature-kimwnasptd-mwa-manifests
Browse files Browse the repository at this point in the history
Introduce GH action for building images with specific version
  • Loading branch information
kimwnasptd committed Feb 14, 2022
2 parents a1cef56 + 45f6828 commit 42220c5
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/docker-publish-releasing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Models web app Docker Publisher (Releasing)

on:
push:
# Publish `master` as Docker `latest` image.
branches:
- master

paths:
- releasing/VERSION

# Run tests for any PRs.
pull_request:

env:
IMAGE_NAME: models-web-app

jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run tests
run: |
docker build . --file Dockerfile
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
# Ensure test job passes before pushing image.
needs: test

runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v2

- name: Build image
run: |
docker build . --file Dockerfile --tag ${IMAGE_NAME}
- name: Log into registry
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}

- name: Push image
run: |
IMAGE_ID=kserve/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$(cat ./releasing/VERSION)
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
4 changes: 4 additions & 0 deletions config/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ resources:
commonLabels:
kustomize.component: kserve-models-web-app
app.kubernetes.io/component: kserve-models-web-app
images:
- name: kserve/models-web-app
newName: kserve/models-web-app
newTag: v0.7.0
configMapGenerator:
- name: kserve-models-web-app-config
literals:
Expand Down
18 changes: 18 additions & 0 deletions releasing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Releasing

This folder contains helper files for releasing the images and manifests of the
web app.

## Steps for releasing

1. Create a new release branch
```
VERSION="v0.7.0"
RELEASE_BRANCH="release-0.7"
git checkout -b $RELEASE_BRANCH origin/master
```
2. Update the VERSION file with the corresponding tag
3. Update the app's kustomization file to use the new tag
4. Submit the PR
5. Once merged the GH Action will tag and push an image based on the contents
of the VERSION file
1 change: 1 addition & 0 deletions releasing/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.7.0

0 comments on commit 42220c5

Please sign in to comment.