-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
action.yml
68 lines (62 loc) · 2.25 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"
pull:
description: "Pull the latest version of builder (set to `false` for testing)"
required: false
default: "true"
runs:
using: "composite"
steps:
- name: Install Cosign
uses: sigstore/[email protected]
with:
cosign-release: "v2.4.0"
- shell: bash
id: version
run: |
input=$(echo "${{ github.action_path }}" | rev | cut -d"/" -f1 | rev)
if [[ "${input}" == "master" ]] || [[ -z "${input}" ]]; then
input="latest"
fi
echo "version=${input}" >> "$GITHUB_OUTPUT"
- shell: bash
if: ${{ inputs.pull == 'true' }}
run: |
docker pull ghcr.io/home-assistant/amd64-builder:${{ steps.version.outputs.version }}
cosign verify \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity-regexp https://github.com/home-assistant/builder/.* \
ghcr.io/home-assistant/amd64-builder:${{ steps.version.outputs.version }}
- shell: bash
id: builder
run: |
builder=$(docker images ghcr.io/home-assistant/amd64-builder:${{ steps.version.outputs.version }} -q)
echo "id=$builder" >> "$GITHUB_OUTPUT"
- 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"