Skip to content
This repository was archived by the owner on Aug 16, 2023. It is now read-only.

Commit b353aba

Browse files
committed
build workflow
Signed-off-by: CrazyMax <[email protected]>
1 parent abba739 commit b353aba

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/build.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- 'master'
8+
- 'v[0-9]*'
9+
tags:
10+
- 'v*'
11+
pull_request:
12+
branches:
13+
- 'master'
14+
- 'v[0-9]*'
15+
16+
env:
17+
# FIXME: Use docker/dockerfile when merged
18+
REPO_SLUG: "crazymax/dockerfile"
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
channel:
27+
- mainline
28+
- labs
29+
steps:
30+
-
31+
name: Checkout
32+
uses: actions/checkout@v2
33+
-
34+
name: Docker meta
35+
id: meta
36+
uses: docker/metadata-action@v3
37+
with:
38+
images: |
39+
${{ env.REPO_SLUG }}
40+
tags: |
41+
type=semver,pattern={{version}},enable=${{ matrix.channel == 'mainline' }}
42+
type=semver,pattern={{version}},suffix=-${{ matrix.channel }},enable=${{ matrix.channel != 'mainline' }}
43+
type=ref,event=branch,enable=${{ matrix.channel == 'mainline' }}
44+
type=ref,event=branch,suffix=-${{ matrix.channel }},enable=${{ matrix.channel != 'mainline' }}
45+
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') && matrix.channel == 'mainline' }}
46+
type=raw,value=latest,suffix=-${{ matrix.channel }},enable=${{ startsWith(github.ref, 'refs/tags/') && matrix.channel != 'mainline' }}
47+
type=ref,event=pr
48+
bake-target: meta-helper
49+
flavor: |
50+
latest=false
51+
-
52+
name: Set up QEMU
53+
uses: docker/setup-qemu-action@v1
54+
-
55+
name: Set up Docker Buildx
56+
uses: docker/setup-buildx-action@v1
57+
-
58+
name: Login to DockerHub
59+
if: github.event_name != 'pull_request'
60+
uses: docker/login-action@v1
61+
with:
62+
username: ${{ secrets.DOCKERHUB_USERNAME }}
63+
password: ${{ secrets.DOCKERHUB_TOKEN }}
64+
-
65+
name: Build image
66+
uses: docker/bake-action@v1
67+
with:
68+
files: |
69+
./docker-bake.hcl
70+
${{ steps.meta.outputs.bake-file }}
71+
targets: image-cross
72+
push: ${{ github.event_name != 'pull_request' }}

0 commit comments

Comments
 (0)