-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
57 lines (55 loc) · 1.46 KB
/
action.yaml
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
name: build-push-image
description: ''
inputs:
repository:
description: ''
required: true
tags:
description: ''
required: true
context:
description: ''
required: true
build-args:
description: ''
required: false
default: buildx
cache_key_suffix:
description: ''
required: false
default: buildx
cache_src:
description: ''
required: false
default: /tmp/cache
cache_dest:
description: ''
required: false
default: /tmp/cache_new
outputs:
digest:
description: ''
value: ${{ steps.build-push.outputs.digest }}
runs:
using: composite
steps:
# Load cache directory ####################################################
- uses: actions/cache@v3
with:
path: ${{ inputs.cache_src }}
key: ${{ inputs.repository }}-${{ inputs.cache_key_suffix }}
# Build and push image ####################################################
- uses: docker/build-push-action@v3
id: build-push
with:
push: true
tags: ${{ inputs.tags }}
cache-from: type=local,src=${{ inputs.cache_src }}
cache-to: type=local,mode=max,dest=${{ inputs.cache_dest }}
build-args: ${{ inputs.build-args }}
context: ${{ inputs.context }}
# Update cache ############################################################
- run: |
rm -rf ${{ inputs.cache_src }} || true
mv ${{ inputs.cache_dest }} ${{ inputs.cache_src }}
shell: bash