-
-
Notifications
You must be signed in to change notification settings - Fork 15
62 lines (55 loc) · 1.64 KB
/
image.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
name: image
on:
pull_request:
push:
branches: [master, release/**, test-me-*]
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: builder-image
run: |
set -euxo pipefail
img=ghcr.io/getsentry/craft-builder:latest
args=()
if docker pull -q "$img"; then
args+=(--cache-from "$img")
fi
docker buildx build \
"${args[@]}" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--target builder \
--tag "$img" \
.
- name: image
run: |
set -euxo pipefail
img=ghcr.io/getsentry/craft:latest
args=()
if docker pull -q "$img"; then
args+=(--cache-from "$img")
fi
docker buildx build \
"${args[@]}" \
--build-arg "SOURCE_COMMIT=$GITHUB_SHA" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--tag "$img" \
.
- name: docker login
run: docker login --username "$DOCKER_USER" --password-stdin ghcr.io <<< "$DOCKER_PASS"
env:
DOCKER_USER: ${{ github.actor }}
DOCKER_PASS: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name != 'pull_request'
- name: docker push
run: |
set -euxo pipefail
craft_builder=ghcr.io/getsentry/craft-builder:latest
craft_latest=ghcr.io/getsentry/craft:latest
craft_versioned="ghcr.io/getsentry/craft:${GITHUB_SHA}"
docker push "$craft_builder"
docker tag "$craft_latest" "$craft_versioned"
docker push "$craft_versioned"
docker push "$craft_latest"
if: github.event_name != 'pull_request'