-
Notifications
You must be signed in to change notification settings - Fork 35
93 lines (80 loc) · 2.88 KB
/
docker.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
90
91
92
93
name: Build & Push to Docker Image Registry (Docker Hub & GitHub Container Registry)
on:
release:
types: [created]
pull_request:
branches:
- main
paths:
- ".github/workflows/docker.yml"
- "debian.Dockerfile"
- "alpine.Dockerfile"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- identifier: "alpine"
dockerfile: alpine.Dockerfile
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/arm/v6
- identifier: "debian"
dockerfile: debian.Dockerfile
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7
steps:
- name: Check Out Repo
uses: actions/[email protected]
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
- name: Login to Docker Hub
uses: docker/[email protected]
if: ${{ github.event_name != 'pull_request' }}
with:
username: hazmi35
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/[email protected]
if: ${{ github.event_name != 'pull_request' }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract tag name
id: tags
run: echo ::set-output name=name::${GITHUB_REF##*/}
- name: Extract flavor
id: flavor
run: if [ "${{ matrix.identifier }}" = "alpine" ]; then echo ::set-output name=name::; else echo ::set-output name=name::-${{ matrix.identifier }}; fi
- name: Generate Docker image metadata
uses: docker/[email protected]
id: img_meta
with:
flavor: |
latest=auto
suffix=${{ steps.flavor.outputs.name }}
images: |
hazmi35/jukebox
ghcr.io/Hazmi35/jukebox
tags: |
${{ steps.tags.outputs.name }}
latest
- name: Build and push
id: docker_build
uses: docker/[email protected]
with:
context: ./
file: ./${{ matrix.dockerfile }}
platforms: ${{ matrix.platforms }}
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.img_meta.outputs.tags }}
labels: ${{ steps.img_meta.outputs.labels }}
# Well, turns out it doesn't support PAT yet. Please see https://github.com/peter-evans/dockerhub-description/issues/24 and https://github.com/docker/roadmap/issues/115
#- name: Update repo description
# uses: peter-evans/[email protected]
# with:
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# repository: hazmi35/jukebox