-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from kubeshop/f1ames/feat/release-flow
Introduce release process
- Loading branch information
Showing
16 changed files
with
752 additions
and
392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
|
||
build-and-push-docker: | ||
runs-on: ubuntu-latest | ||
name: Docker images | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
from: [init, server] | ||
|
||
steps: | ||
- name: Extract version from tag | ||
id: extract_version | ||
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: Docker Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build image and push to Docker Hub | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./admission-controller/${{ matrix.from }}/ | ||
file: ./admission-controller/${{ matrix.from }}/Dockerfile | ||
tags: | | ||
kubeshop/monokle-admission-controller-${{ matrix.from }}:latest | ||
kubeshop/monokle-admission-controller-${{ matrix.from }}:${{ env.VERSION }} | ||
push: true | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
|
||
- name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||
build-and-push-helm: | ||
runs-on: ubuntu-latest | ||
name: Helm chart | ||
|
||
steps: | ||
- name: Extract version from tag | ||
id: extract_version | ||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | ||
|
||
- name: Debug version | ||
run: echo ${{ env.VERSION }} | ||
|
||
- 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 | ||
|
||
# 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 | ||
name: GitHub release | ||
needs: [build-and-push-docker, build-and-push-helm] | ||
|
||
steps: | ||
- name: Extract version from tag | ||
id: extract_version | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.