-
Notifications
You must be signed in to change notification settings - Fork 2
89 lines (79 loc) · 2.63 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
name: Build and push image
on:
push:
paths:
- 'docker/**'
- 'version.json'
branches: ['main']
pull_request:
paths:
- 'docker/**'
- 'version.json'
workflow_dispatch:
jobs:
docker-build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: standard
dockerfile: docker/Dockerfile
platforms: |-
linux/amd64
linux/arm/v7
image_name: "docker-zshark"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.platforms }}
restore-keys: |
${{ runner.os }}-buildx-${{ github.sha }}-${{ matrix.platforms }}
${{ runner.os }}-buildx-
- name: Login to DocikerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: get version
id: version
uses: notiz-dev/github-action-json-property@release
with:
path: 'version.json'
prop_path: 'version'
- name: Build and push ${{ matrix.name }}
uses: docker/build-push-action@v2
with:
context: ./docker/
file: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platforms }}
build-args: |
VERSION=${{ steps.version.outputs.prop }}
push: ${{ github.event_name != 'pull_request' }}
tags: |
deconzcommunity/zshark:latest
deconzcommunity/zshark:${{ steps.version.outputs.prop }}
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.prop }}
labels: |
maintainer=${{ github.repository_owner }}
org.opencontainers.image.vendor=${{ github.repository_owner }}
org.opencontainers.image.revision=${{ github.sha }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache