1
Fork 0
photoview/.github/workflows/build.yml

76 lines
2.1 KiB
YAML
Raw Normal View History

name: Docker builds
2020-08-09 20:32:02 +02:00
on:
push:
2023-07-10 22:49:01 +02:00
branches: [master]
2020-08-09 20:32:02 +02:00
tags:
- v*
2024-09-02 18:35:45 +02:00
pull_request:
branches: [master]
env:
2024-09-02 18:35:45 +02:00
IS_PUSHING_IMAGES: ${{ github.event_name != 'pull_request' && github.repository == 'photoview/photoview' }}
DOCKER_USERNAME: viktorstrate
DOCKER_IMAGE: viktorstrate/photoview
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
2020-08-09 20:32:02 +02:00
jobs:
build:
name: Build Docker Image
runs-on: ubuntu-latest
2020-08-09 20:32:02 +02:00
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ env.PLATFORMS }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Login
2024-09-02 18:35:45 +02:00
if: ${{ env.IS_PUSHING_IMAGES == 'true' }}
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: ${{ env.DOCKER_IMAGE }}
# Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: ${{ env.PLATFORMS }}
pull: true
2024-09-02 18:35:45 +02:00
push: ${{ env.IS_PUSHING_IMAGES }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
sbom: true
provenance: mode=max
annotations: ${{ steps.docker_meta.outputs.annotations }}
build-args: |
VERSION=${{ github.ref_name }}
COMMIT_SHA=${{ github.sha }}