Skip to content

Add fleet stats

Add fleet stats #18

name: Build and Publish Docker Image
on:
push:
branches: [ "main" ]
# Publish semver tags as releases
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]
env:
REGISTRY: ghcr.io
# The repository name is already included in github.repository (awlx/bmwtools)
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge with sigstore/fulcio
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Set up Docker Buildx for multi-platform builds
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Login to GitHub Container Registry
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata for the Docker image
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,format=short
type=ref,event=branch
type=ref,event=pr
type=raw,value=pr-${{ github.head_ref || github.ref_name }},enable=${{ github.event_name == 'pull_request' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
# Build and push Docker image
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: ./go-rewrite
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max