-
-
Notifications
You must be signed in to change notification settings - Fork 104
103 lines (100 loc) · 3.15 KB
/
build.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
94
95
96
97
98
99
100
101
102
103
name: build
on:
push:
branches:
- 'master'
tags:
- '*'
paths-ignore:
- '**.md'
pull_request:
branches:
- 'master'
paths-ignore:
- '**.md'
env:
DOCKERHUB_SLUG: crazymax/rtorrent-rutorrent
GHCR_SLUG: ghcr.io/crazy-max/rtorrent-rutorrent
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Cache Docker layers
uses: actions/cache@v2.1.4
with:
path: /tmp/.docker-cache
key: ${{ runner.os }}-docker-${{ github.sha }}
restore-keys: |
${{ runner.os }}-docker-
-
name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: |
${{ env.DOCKERHUB_SLUG }}
${{ env.GHCR_SLUG }}
tag-edge: true
tag-match: (.*)-r
tag-match-group: 1
label-custom: |
org.opencontainers.image.title=rTorrent and ruTorrent
org.opencontainers.image.description=rTorrent and ruTorrent
org.opencontainers.image.vendor=CrazyMax
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
-
name: Build
uses: docker/bake-action@v1
with:
files: |
./docker-bake.hcl
${{ steps.docker_meta.outputs.bake-file }}
targets: image-all
push: ${{ github.event_name != 'pull_request' }}
set: |
*.cache-from=type=local,src=/tmp/.docker-cache
*.cache-to=type=local,dest=/tmp/.docker-cache-new
-
name: Check manifest
if: github.event_name != 'pull_request'
run: |
docker buildx imagetools inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.docker_meta.outputs.version }}
docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:${{ steps.docker_meta.outputs.version }}
-
# FIXME: https://github.com/docker/build-push-action/issues/252
name: Move cache
run: |
rm -rf /tmp/.docker-cache
mv /tmp/.docker-cache-new /tmp/.docker-cache
-
name: Inspect image
if: github.event_name != 'pull_request'
run: |
docker pull ${{ env.DOCKERHUB_SLUG }}:${{ steps.docker_meta.outputs.version }}
docker image inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.docker_meta.outputs.version }}
docker pull ${{ env.GHCR_SLUG }}:${{ steps.docker_meta.outputs.version }}
docker image inspect ${{ env.GHCR_SLUG }}:${{ steps.docker_meta.outputs.version }}