tstor/.github/workflows/docker.yaml

73 lines
1.8 KiB
YAML
Raw Normal View History

name: docker
on:
push:
2023-10-08 16:46:03 +00:00
branches:
- master
tags:
2023-10-08 16:46:03 +00:00
- "v*"
jobs:
2023-10-13 08:03:02 +00:00
build-docker:
2023-10-18 09:52:48 +00:00
permissions:
contents: read
packages: write
2023-10-13 08:03:02 +00:00
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
- linux/386
2023-10-18 09:52:48 +00:00
- linux/arm/v5
2023-10-13 08:03:02 +00:00
- linux/arm/v7
2023-10-18 09:52:48 +00:00
- linux/arm64/v8
- linux/riscv64
runs-on: ubuntu-latest
steps:
2023-10-13 08:03:02 +00:00
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
2023-10-18 09:52:48 +00:00
uses: docker/setup-qemu-action@v3
2023-10-13 08:03:02 +00:00
- name: Set up Docker Buildx
2023-10-18 09:52:48 +00:00
uses: docker/setup-buildx-action@v3
2023-10-13 08:03:02 +00:00
2023-10-18 09:52:48 +00:00
- name: Login to Container Registry
uses: docker/login-action@v3
2023-10-13 08:03:02 +00:00
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
2021-04-04 19:00:21 +00:00
id: meta
2023-10-13 08:03:02 +00:00
uses: docker/metadata-action@v5
with:
2023-10-13 08:03:02 +00:00
# list of Docker images to use as base name for tags
images: ghcr.io/${{ github.repository }}
# generate Docker tags based on the following events/attributes
2021-04-04 19:00:21 +00:00
tags: |
2023-10-13 08:03:02 +00:00
type=schedule
2021-04-04 19:00:21 +00:00
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
2023-10-13 08:03:02 +00:00
type=semver,pattern={{major}}
type=sha
2023-10-13 08:03:02 +00:00
- name: Build and push Docker image
2023-10-18 09:52:48 +00:00
uses: docker/build-push-action@v5
with:
2021-04-04 19:00:21 +00:00
context: .
2023-10-13 08:03:02 +00:00
push: true
pull: true
platforms: ${{ matrix.platform }}
2021-04-04 19:00:21 +00:00
labels: ${{ steps.meta.outputs.labels }}
2023-10-13 08:03:02 +00:00
sbom: true
provenance: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}