Skip to content

Introduce release process #8

Introduce release process

Introduce release process #8

Workflow file for this run

name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request: # For testing only
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Extract version from tag
id: extract_version
run: echo "VERSION=0.0.3" >> $GITHUB_ENV
# run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Debug version
run: echo ${{ env.VERSION }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login Helm to DockerHub registry
run: |
helm registry login registry-1.docker.io -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin <<< "${{ secrets.DOCKERHUB_TOKEN }}"
- name: Checkout Repository
uses: actions/checkout@v2
- name: Build image and push to Docker Hub (init container)
uses: docker/build-push-action@v4
with:
context: ./admission-controller/init/
file: ./admission-controller/init/Dockerfile
tags: |
kubeshop/monokle-admission-controller-init:latest
kubeshop/monokle-admission-controller-init:${{ env.VERSION }}
push: true
- name: Build image and push to Docker Hub (server container)
uses: docker/build-push-action@v4
with:
context: ./admission-controller/server/
file: ./admission-controller/server/Dockerfile
tags: |
kubeshop/monokle-admission-controller-server:latest
kubeshop/monokle-admission-controller-server:${{ env.VERSION }}
push: true
# See https://docs.docker.com/docker-hub/oci-artifacts/#push-a-helm-chart
- name: Build and publish Helm chart
env:
VERSION: ${{ env.VERSION }}
run: |
echo "Building Helm chart with version: ${VERSION}"
helm package ./helm --version ${VERSION}
helm push monokle-admission-controller-${VERSION}.tgz oci://registry-1.docker.io/kubeshop
create-release:
runs-on: ubuntu-latest
needs: build-and-push
steps:
- name: Extract version from tag
id: extract_version
run: echo "VERSION=0.0.3" >> $GITHUB_ENV
# run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Debug version
run: echo ${{ env.VERSION }}
- name: Checkout Repository
uses: actions/checkout@v2
- name: Build release artifacts
env:
VERSION: ${{ env.VERSION }}
run: |
helm package ./helm --version ${VERSION}
helm template ./helm --version ${VERSION} > install.yaml
mv monokle-admission-controller-${VERSION}.tgz helm.tgz
- name: Create release and upload artifacts
uses: ncipollo/release-action@v1
with:
name: "Release ${{ env.VERSION }}"
allowUpdates: true
artifacts: 'install.yaml,helm.tgz'
omitBody: true
token: ${{ secrets.CI_BOT_TOKEN }}