Browse Source

Improve docker image tagging

pull/1134/head
Anders Sparrevohn 3 years ago
parent
commit
4f50761be2
  1. 20
      .github/workflows/docker-image.yml

20
.github/workflows/docker-image.yml

@ -1,10 +1,12 @@
name: Docker image CD name: Docker image CD
on: on:
workflow_dispatch:
push: push:
tags: tags:
- '*.*.*' - '*.*.*'
pull_request:
branches:
- 'master'
jobs: jobs:
build_and_push: build_and_push:
@ -13,6 +15,16 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: grobut939/ghostfolio
tags: |
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2
@ -21,6 +33,7 @@ jobs:
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
- name: Login to DockerHub - name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
@ -31,7 +44,8 @@ jobs:
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: true push: ${{ github.event_name != 'pull_request' }}
tags: grobut939/ghostfolio:latest tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.output.labels }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max

Loading…
Cancel
Save