-
Notifications
You must be signed in to change notification settings - Fork 96
154 lines (140 loc) · 4.49 KB
/
build-and-publish.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
---
name: build_container
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
on:
pull_request:
push:
tag:
- '*'
jobs:
build_container:
runs-on: ubuntu-22.04
outputs:
json: ${{ steps.metadata.outputs.json }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: login to ghcr.io
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: extract metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag
type=ref,event=pr
type=ref,event=branch
- name: build container
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
labels: ${{ steps.metadata.outputs.labels }}
tags: ${{ steps.metadata.outputs.tags }}
- name: debug
run: echo "${{ fromJSON(steps.metadata.outputs.json).tags[0] }}"
build-willow-dist:
strategy:
matrix:
device:
- ESP32_S3_BOX
- ESP32_S3_BOX_LITE
runs-on: ubuntu-22.04
needs: build_container
container:
image: ${{ fromJSON(needs.build_container.outputs.json).tags[0] }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
volumes:
- "${{github.workspace}}:/willow"
# https://github.com/actions/runner/issues/878#issuecomment-1248930921
defaults:
run:
working-directory: /willow
env:
dist_filename: "willow-dist-${{ matrix.device }}.bin"
ota_filename: "willow-ota-${{ matrix.device }}.bin"
partitions_filename: "willow-partitions-${{ matrix.device }}"
steps:
- name: checkout
uses: actions/checkout@v3
- name: debug
run: echo ${{ needs.build_container.outputs.tags }}
- name: ls -al
run: ls -al
- name: ls -al /
run: ls -al /
# fatal: detected dubious ownership in repository at '/willow'
- name: id
run: id
# ./utils.sh: line 193: idf.py: command not found
# - name: . $IDF_PATH/export.sh
# run: . "$IDF_PATH/export.sh"
# need to run it in the same step as utils.sh bloody hell
- name: env
run: env
- name: pwd
run: pwd
- name: add /willow to git safe directories
run: git config --global --add safe.directory /willow
# need to run with bash to avoid this error:
# /opt/esp/idf/export.sh: [[: not found
- name: ./utils.sh setup
run: ( . "$IDF_PATH/export.sh"; ./utils.sh setup )
shell: bash
- name: append device type to sdkconfig
run: echo "CONFIG_${{ matrix.device }}_BOARD=y" >> sdkconfig
- name: ./utils.sh build
run: ( . "$IDF_PATH/export.sh"; ./utils.sh build )
shell: bash
- name: ./utils.sh dist
run: ( . "$IDF_PATH/export.sh"; ./utils.sh dist )
shell: bash
- name: copy willow.bin to ota_filename
run: cp /willow/build/willow.bin "/willow/build/${{ env.ota_filename }}"
- name: upload willow-dist.bin artifact
uses: actions/upload-artifact@v3
with:
name: "${{ env.dist_filename }}"
path: "/willow/build/${{ env.dist_filename }}"
- name: upload willow-ota.bin artifact
uses: actions/upload-artifact@v3
with:
name: "${{ env.ota_filename }}"
path: "/willow/build/${{ env.ota_filename }}"
- name: upload build artifacts
uses: actions/upload-artifact@v3
with:
name: "${{ env.partitions_filename }}"
path: |
/willow/build/*.bin
/willow/build/srmodels/srmodels.bin
/willow/partitions_willow.csv
/willow/sdkconfig
!/willow/build/${{ env.dist_filename }}
publish-release:
if: github.ref_type == 'tag'
runs-on: ubuntu-22.04
needs: build-willow-dist
steps:
- name: download artifacts
uses: actions/download-artifact@v3
- name: pwd
run: pwd
- name: find -ls
run: find -ls
- name: create release
uses: ncipollo/release-action@v1
with:
allowUpdates: false
artifacts: "willow-dist-*/willow-dist-*.bin,willow-ota-*/willow-ota-*.bin"
prerelease: ${{ contains(github.ref, 'pre') }}