-
Notifications
You must be signed in to change notification settings - Fork 12
/
action.yml
126 lines (119 loc) · 3.95 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
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
name: ESPHome Builder
description: Builds ESPHome binaries
inputs:
yaml-file:
description: YAML file to use
required: true
version:
description: Version of ESPHome to build
required: false
default: latest
platform:
description: Platform (OS/Arch) to use
required: false
default: linux/amd64
cache:
description: Cache build directory
required: false
default: false
deprecationMessage: |
There is little to no gain in caching the build directory as
ESPHome will wipe the build artifacts in most cases for releases.
This will be removed in a future release.
release-summary:
description: Release summary
required: false
default: ""
release-url:
description: Release URL
required: false
default: ""
complete-manifest:
description: Output complete esp-web-tools manifest.json
required: false
default: false
outputs:
name:
description: Name of device extracted from configuration with the platform appended
value: ${{ steps.build-step.outputs.name }}
version:
description: ESPHome version
value: ${{ steps.build-step.outputs.esphome-version }}
original-name:
description: Original name of device extracted from configuration
value: ${{ steps.build-step.outputs.original-name }}
project-name:
description: Project name extracted from configuration
value: ${{ steps.build-step.outputs.project-name }}
project-version:
description: Project version extracted from configuration
value: ${{ steps.build-step.outputs.project-version }}
runs:
using: composite
steps:
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
with:
platforms: ${{ inputs.platform }}
- name: Build ESPHome image
uses: docker/[email protected]
env:
DOCKER_BUILD_SUMMARY: false
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: ${{ github.action_path }}
load: true
tags: esphome:${{ inputs.version }}
build-args: VERSION=${{ inputs.version }}
platforms: ${{ inputs.platform }}
- if: ${{ inputs.cache == 'true' }}
id: data-dir
shell: bash
run: |
data_dir=$(dirname ${{ inputs.yaml-file }})/.esphome
echo "data_dir=$data_dir" >> $GITHUB_OUTPUT
- if: ${{ inputs.cache == 'true' }}
name: Cache platformio directory
uses: actions/[email protected]
with:
path: ~/.platformio
key: ${{ runner.os }}-esphome-${{ inputs.yaml-file }}-${{ inputs.version }}-platformio
- if: ${{ inputs.cache == 'true' }}
name: Cache build directory
uses: actions/[email protected]
with:
path: ${{ steps.data-dir.outputs.data_dir }}/build
key: ${{ runner.os }}-esphome-${{ inputs.yaml-file }}-${{ inputs.version }}-build
save-always: true
- if: ${{ inputs.cache == 'true' }}
name: Cache storage directory
uses: actions/[email protected]
with:
path: ${{ steps.data-dir.outputs.data_dir }}/storage
key: ${{ runner.os }}-esphome-${{ inputs.yaml-file }}-${{ inputs.version }}-storage
save-always: true
- name: Run container
shell: bash
id: build-step
run: |-
summary=$(cat <<'ENDOFSUMMARY'
${{ inputs.release-summary }}
ENDOFSUMMARY
)
docker run --rm \
--platform ${{ inputs.platform }} \
--workdir /github/workspace \
-v "$(pwd)":"/github/workspace" -v "$HOME:$HOME" \
--user $(id -u):$(id -g) \
-e HOME \
esphome:${{ inputs.version }} \
${{ inputs.yaml-file }} \
--release-summary "$summary" \
--release-url "${{ inputs.release-url }}" \
--outputs-file "$GITHUB_OUTPUT" \
${{ inputs.complete-manifest == 'true' && '--complete-manifest' || '--partial-manifest' }}
branding:
icon: "archive"
color: "white"