forked from moby/buildkit
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (135 loc) · 4.1 KB
/
frontend.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: frontend
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- 'master'
- 'v[0-9]+.[0-9]+'
tags:
- 'dockerfile/*'
pull_request:
paths-ignore:
- 'README.md'
- 'docs/**'
- 'frontend/dockerfile/docs/**'
env:
GO_VERSION: "1.21"
SETUP_BUILDX_VERSION: "latest"
SETUP_BUILDKIT_TAG: "moby/buildkit:latest"
IMAGE_NAME: "docker/dockerfile-upstream"
PLATFORMS: "linux/386,linux/amd64,linux/arm/v7,linux/arm64,linux/mips,linux/mipsle,linux/mips64,linux/mips64le,linux/s390x,linux/ppc64le,linux/riscv64"
jobs:
test:
uses: ./.github/workflows/.test.yml
secrets: inherit
with:
cache_scope: frontend-integration-tests
pkgs: ./frontend/dockerfile
kinds: |
integration
dockerfile
codecov_flags: dockerfile-frontend
prepare:
runs-on: ubuntu-22.04
if: github.event_name != 'schedule'
outputs:
typ: ${{ steps.prep.outputs.typ }}
push: ${{ steps.prep.outputs.push }}
tag: ${{ steps.prep.outputs.tag }}
tags: ${{ steps.prep.outputs.tags }}
steps:
-
name: Prepare
id: prep
run: |
TYP=master
TAG=mainline
PUSH=false
if [[ $GITHUB_REF == refs/tags/dockerfile/* ]]; then
TYP=tag
TAG=${GITHUB_REF#refs/tags/}
PUSH=push
elif [[ $GITHUB_REF == refs/heads/* ]]; then
if [ $GITHUB_REF = "refs/heads/${{ github.event.repository.default_branch }}" ]; then
PUSH=push
fi
fi
if [ "$GITHUB_REPOSITORY" != "moby/buildkit" ]; then
PUSH=false
fi
echo "typ=${TYP}" >>${GITHUB_OUTPUT}
echo "push=${PUSH}" >>${GITHUB_OUTPUT}
echo "tag=${TAG}" >>${GITHUB_OUTPUT}
if [ "${TYP}" = "master" ]; then
echo "tags=$(jq -cn --arg tag "$TAG" '[$tag, "labs"]')" >>${GITHUB_OUTPUT}
else
echo "tags=$(jq -cn --arg tag "$TAG" '[$tag]')" >>${GITHUB_OUTPUT}
fi
image:
runs-on: ubuntu-22.04
needs:
- test
- prepare
strategy:
fail-fast: false
matrix:
tag: ${{ fromJson(needs.prepare.outputs.tags) }}
steps:
-
name: Prepare
run: |
if [[ "${{ matrix.tag }}" = "labs" ]] || [[ "${{ matrix.tag }}" == *-labs ]]; then
echo "CACHE_SCOPE=frontend-labs" >>${GITHUB_ENV}
else
echo "CACHE_SCOPE=frontend-mainline" >>${GITHUB_ENV}
fi
-
name: Checkout
uses: actions/checkout@v4
-
name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ env.SETUP_BUILDX_VERSION }}
driver-opts: image=${{ env.SETUP_BUILDKIT_TAG }}
buildkitd-flags: --debug
-
name: Login to DockerHub
uses: docker/login-action@v3
if: needs.prepare.outputs.push == 'push'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build
run: |
./frontend/dockerfile/cmd/dockerfile-frontend/hack/release "${{ needs.prepare.outputs.typ }}" "${{ matrix.tag }}" "$IMAGE_NAME" "${{ needs.prepare.outputs.push }}"
env:
RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') }}
CACHE_FROM: type=gha,scope=${{ env.CACHE_SCOPE }}
CACHE_TO: type=gha,scope=${{ env.CACHE_SCOPE }}
release:
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/dockerfile')
needs:
- prepare
- test
- image
steps:
-
name: GitHub Release
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # v2.0.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
name: ${{ needs.prepare.outputs.tag }}