2020-08-09 21:13:25 +02:00
|
|
|
name: Docker builds
|
2020-08-09 20:32:02 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
2023-07-10 22:49:01 +02:00
|
|
|
branches: [master]
|
2020-08-09 20:32:02 +02:00
|
|
|
push:
|
2023-07-10 22:49:01 +02:00
|
|
|
branches: [master]
|
2020-08-09 20:32:02 +02:00
|
|
|
tags:
|
|
|
|
- v*
|
2021-03-29 12:36:14 +02:00
|
|
|
|
2021-03-28 23:03:42 +02:00
|
|
|
env:
|
|
|
|
DOCKER_USERNAME: viktorstrate
|
|
|
|
DOCKER_IMAGE: viktorstrate/photoview
|
|
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
2020-08-09 20:32:02 +02:00
|
|
|
|
|
|
|
jobs:
|
2020-08-09 21:13:25 +02:00
|
|
|
build:
|
2021-03-28 21:24:32 +02:00
|
|
|
name: Build Docker Image
|
2021-02-16 10:44:38 +01:00
|
|
|
runs-on: ubuntu-20.04
|
2021-03-29 12:36:14 +02:00
|
|
|
|
2020-08-09 20:32:02 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
2020-08-09 21:13:25 +02:00
|
|
|
|
|
|
|
- name: Cache Docker layers
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: cache
|
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
2021-03-28 19:39:22 +02:00
|
|
|
key: ${{ runner.os }}-buildx-${{ secrets.CACHE_KEY }}-${{ matrix.target_platform }}-${{ github.sha }}
|
2021-03-28 19:27:25 +02:00
|
|
|
restore-keys: |
|
2021-03-28 19:39:22 +02:00
|
|
|
${{ runner.os }}-buildx-${{ secrets.CACHE_KEY }}-${{ matrix.target_platform }}-
|
2020-08-09 21:13:25 +02:00
|
|
|
|
2020-12-09 19:24:39 +01:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
with:
|
2021-03-28 19:39:22 +02:00
|
|
|
platforms: ${{ matrix.target_platform }}
|
2020-12-09 19:24:39 +01:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
2021-03-28 23:03:42 +02:00
|
|
|
- name: Docker Login
|
2021-03-29 12:36:14 +02:00
|
|
|
if: success() && github.event_name != 'pull_request' && github.repository == 'photoview/photoview'
|
2023-07-10 18:37:18 +02:00
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
username: ${{ env.DOCKER_USERNAME }}
|
|
|
|
password: ${{ env.DOCKER_PASSWORD }}
|
|
|
|
|
|
|
|
- name: Docker meta
|
|
|
|
id: docker_meta
|
|
|
|
uses: docker/metadata-action@v3
|
|
|
|
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@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
|
|
|
|
push: ${{ github.event_name != 'pull_request' && github.repository == 'photoview/photoview' }}
|
|
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
2024-08-27 21:46:29 +02:00
|
|
|
build-args: |
|
|
|
|
VERSION=${{ github.ref_name }}
|
|
|
|
COMMIT_SHA=${{ github.sha }}
|