/
action.yml
68 lines (60 loc) · 2.09 KB
/
action.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
name: "Home Assistant builder"
description: "Multi-purpose cross-compile docker builder"
inputs:
args:
description: "Arguments passed to the builder"
required: true
default: "--help"
runs:
using: "composite"
steps:
- shell: bash
id: version
run: |
input=$(echo "${{ github.action_path }}" | cut -d"/" -f8 )
if [[ "${input}" == "master" ]] || [[ -z "${input}" ]]; then
input="latest"
fi
echo "::set-output name=version::${input}"
- uses: home-assistant/actions/helpers/cas@master
- shell: bash
run: |
docker pull ghcr.io/home-assistant/amd64-builder:${{ steps.version.outputs.version }}
- shell: bash
run: |
for j in {1..15}; do
if CAS_API_KEY= cas authenticate --silent --signerID notary@home-assistant.io docker://ghcr.io/home-assistant/amd64-builder:${{ steps.version.outputs.version }}; then
exit 0
fi
sleep $((5 * j))
done
echo "Invalid signature!"
exit 1
- shell: bash
id: builder
run: |
builder=$(docker images ghcr.io/home-assistant/amd64-builder:${{ steps.version.outputs.version }} -q)
echo "::set-output name=id::$builder"
- shell: bash
id: build
run: |
env > "${{ github.action_path }}/env_file"
sed -i "/\(HOME\|TERM\|PWD\|HOSTNAME\|PATH\|SHLVL\|USER\|GOROOT\)/d" "${{ github.action_path }}/env_file"
docker run --rm --privileged \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v ~/.docker:/root/.docker \
-v ${{ github.workspace }}:/data \
--env-file "${{ github.action_path }}/env_file" \
ghcr.io/home-assistant/amd64-builder:${{ steps.version.outputs.version }} \
${{ inputs.args }}
- shell: bash
id: verify
run: |
docker images \
--format "table {{.Repository}}:{{.Tag}}\t{{.Size}}" \
--filter reference="*/*" \
--filter reference="*" \
--filter since=${{ steps.builder.outputs.id }}
branding:
icon: "home"
color: "blue"