Multiplatform build #15
Workflow file for this run
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
name: Release | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
jobs: | |
build-and-push-docker: | |
runs-on: ubuntu-latest | |
name: Docker images | |
strategy: | |
fail-fast: true | |
matrix: | |
from: [init, server, synchronizer] | |
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@v5 | |
with: | |
context: ./admission-controller/${{ matrix.from }}/ | |
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 | |
file: ./admission-controller/${{ matrix.from }}/Dockerfile | |
tags: | | |
kubeshop/monokle-admission-controller-${{ matrix.from }}:latest | |
kubeshop/monokle-admission-controller-${{ matrix.from }}:${{ env.VERSION }} | |
push: false | |
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 | |
# needs: [build-and-push-docker] | |
# 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-standalone.yaml | |
# helm template ./helm --version ${VERSION} --set automationToken=SAMPLE_TOKEN > install-cloud.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: 'helm.tgz,install-cloud.yaml,install-standalone.yaml' | |
# omitBody: true | |
# token: ${{ secrets.CI_BOT_TOKEN }} |