-
-
Notifications
You must be signed in to change notification settings - Fork 197
77 lines (75 loc) · 2.2 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
name: Build docker images
on:
push:
workflow_dispatch:
inputs:
commit:
description: 'Commit to extract from'
type: string
branch:
description: 'Branch to extract from'
type: string
login:
description: 'Log in to Docker Hub'
type: boolean
default: true
push:
description: 'Push the built images'
type: boolean
default: false
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
TAG: ${{steps.get-parameters.outputs.TAG}}
steps:
- name: Download build parameters
if: github.event_name == 'workflow_dispatch'
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
workflow_conclusion: success
commit: ${{inputs.commit}}
branch: ${{inputs.branch}}
event: push
name: parameters
- name: Get build parameters
id: get-parameters
run: |
if [ -f parameters.txt ]; then
cat parameters.txt >> $GITHUB_OUTPUT
else
echo TAG=test >> $GITHUB_OUTPUT
fi
cat $GITHUB_OUTPUT
docker-build:
needs: [prepare]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { file: Dockerfile, maintag: latest, prefix: }
- { file: Dockerfile.dev, maintag: dev, prefix: dev- }
steps:
- uses: actions/checkout@v3
with:
ref: ${{ (inputs.commit != '' && inputs.commit) || inputs.branch }}
- name: Log in to Docker Hub
if: ${{inputs.login}}
uses: docker/login-action@v2
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: Build Docker images
uses: docker/build-push-action@v4
with:
context: .
push: ${{ (github.event_name == 'workflow_dispatch' && inputs.push) || false }}
file: ./${{matrix.file}}
tags: |
mstorsjo/llvm-mingw:${{matrix.maintag}}
mstorsjo/llvm-mingw:${{matrix.prefix}}${{needs.prepare.outputs.TAG}}
- name: Inspect Docker images
run: |
docker images