Skip to content

build on tags

build on tags #214

Workflow file for this run

name: Build Image & Chart
on:
push:
branches:
- main
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install Cosign
uses: sigstore/cosign-installer@main
with:
cosign-release: 'v2.2.0'
- name: Login Build Sign Push
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${GHR} -u ${{ github.actor }} --password-stdin
docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}" ${MTR}
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
export DOCKER_BUILDKIT=1
docker build -f Dockerfile -t ${MTR}/${REPO}/${IMAGE}:${VERSION} .
docker tag ${MTR}/${REPO}/${IMAGE}:${VERSION} ${GHR}/${{ github.repository_owner }}/${IMAGE}/${IMAGE}:${VERSION}
docker push ${MTR}/${REPO}/${IMAGE}:${VERSION}
docker push ghcr.io/${{ github.repository_owner }}/${IMAGE}/${IMAGE}:${VERSION}
cosign sign --key env://COSIGN_KEY --tlog-upload=false ${MTR}/${REPO}/${IMAGE}:${VERSION}
cosign sign --key env://COSIGN_KEY --tlog-upload=false ${GHR}/${{ github.repository_owner }}/${IMAGE}/${IMAGE}:${VERSION}
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
GHR: ghcr.io
MTR: mtr.devops.telekom.de
REPO: caas
IMAGE: cosignwebhook
COSIGN_KEY: ${{secrets.COSIGN_KEY}}
COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}}
- name: Helm lint & package & push
run: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm version
HELM_EXPERIMENTAL_OCI=1 helm registry login ${GHR} -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
HELM_EXPERIMENTAL_OCI=1 helm registry login ${MTR} -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
helm lint chart
helm package chart
HELM_EXPERIMENTAL_OCI=1 helm push $(ls *.tgz| head -1) oci://${GHR}/${{ github.actor }}/charts
HELM_EXPERIMENTAL_OCI=1 helm push $(ls *.tgz| head -1) oci://${MTR}/${REPO}/charts
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
GHR: ghcr.io
MTR: mtr.devops.telekom.de
REPO: caas