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

70 lines
2.2 KiB
YAML

name: Dependencies builds
on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
# At 23:18 every Wednesday, 2 hours before `photoview`. Details in https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule
- cron: '18 23 * * 3'
env:
IS_PUSHING_IMAGES: ${{ github.event_name != 'pull_request' && github.repository == 'photoview/photoview' }}
IS_CACHING: ${{ github.event_name == 'pull_request' }}
DOCKER_USERNAME: viktorstrate
DOCKER_IMAGE: viktorstrate/dependencies
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
jobs:
build:
name: Build Dependencies Image
runs-on: ubuntu-latest
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
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=raw,value=latest
type=sha
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./dependencies
platforms: ${{ env.PLATFORMS }}
pull: true
push: ${{ env.IS_PUSHING_IMAGES }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: ${{ ( env.IS_CACHING == 'true' && 'type=gha' ) || '' }}
cache-to: ${{ ( env.IS_CACHING == 'true' && 'type=gha,mode=max' ) || '' }}
no-cache: ${{ env.IS_CACHING != 'true' }}
sbom: true
provenance: mode=max
annotations: ${{ steps.docker_meta.outputs.annotations }}