Skip to content

v1.0.6

v1.0.6 #9

Workflow file for this run

name: Build and Push Docker Image
on:
release:
types: [published] # Triggers on release tagging
jobs:
build:
runs-on: ubuntu-latest
# This job runs only if the tag_name starts with 'v', this avoids conflicts with helm
# chart releases which have simple-sidecar-helm-chart-{{ .Version }} as the release name
if: startsWith(github.event.release.tag_name, 'v')
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Convert repository name to lowercase
id: lowercase_repo
run: echo "::set-output name=lower_repo::$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')"
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
ghcr.io/${{ steps.lowercase_repo.outputs.lower_repo }}:latest
ghcr.io/${{ steps.lowercase_repo.outputs.lower_repo }}:${{ github.event.release.tag_name }}
platforms: linux/amd64,linux/arm64
- name: Logout from GitHub Container Registry
run: docker logout ghcr.io