-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (88 loc) · 3.47 KB
/
cd-release.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
name: Release build
run-name: >
${{ github.event.release.prerelease && 'Prerelease' || 'Release' }} build:
${{ github.event.release.name }}"
on:
release:
types: [released, prereleased]
env:
RELEASE_TYPE: ${{ github.event.release.prerelease && 'Prerelease' || 'Release' }}
RELEASE_CHANNEL: ${{ github.event.release.prerelease && 'dev' || 'release' }}
jobs:
build-release:
name: Build & upload to release
runs-on: ubuntu-latest
steps:
- name: Checkout repo + submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build with ESP-IDF
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v4.4.7
target: esp32
- name: Upload release assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
gh release upload "${{ github.event.release.tag_name }}"
build/TROOPERS24.bin
build/TROOPERS24.elf
- name: Dispatch OTA hook
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.OTA_PUSH_TOKEN }}
repository: badgeteam/ota
event-type: firmware-release
client-payload: >
{
"device_id": "troopers24",
"device_name": "TROOPERS24",
"tag": "${{ github.event.release.tag_name }}",
"channel": "${{ env.RELEASE_CHANNEL }}",
"fw_main": "TROOPERS24.bin"
}
- name: Generate release build report
if: success() || failure()
env:
repo: ${{ github.repository }}
tag: ${{ github.event.release.tag_name }}
compare_url_template: ${{ format('/{0}/compare/{{base}}...{{head}}', github.repository) }}
run: |
previous_tag=$(git tag --sort '-refname' | grep -A1 "$tag" | tail -1)
tag_compare_url=$(sed "s!{base}!$previous_tag!; s!{head}!$tag!" <<< $compare_url_template)
build_size_main=$(du build/TROOPERS24.bin | awk '{ print $1 }')
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
cat << $EOF >> $GITHUB_STEP_SUMMARY
# $RELEASE_TYPE build summary 🚀${{ github.event.release.prerelease && '🚧' || '' }}🔨
**Release:** [${{ github.event.release.name }}](${{ github.event.release.html_url }})
**Source:** [${repo}@\`${tag}\`](/${repo}/tree/${tag})
## Build details
**Size of \`TROOPERS24.bin\`:** $build_size_main kB
\`\`\`console
\$ du -h build/*.bin build/*.elf build/*/*.bin build/*/*.elf
$(du -h build/*.bin build/*.elf build/*/*.bin build/*/*.elf)
\`\`\`
### Source
**Diff with previous tag:** $tag_compare_url
#### Submodules
\`\`\`
$(
git submodule --quiet foreach '
branch=$(grep -C1 "$(git config --get remote.origin.url)" $toplevel/.gitmodules | grep "branch =" | rev | cut -d" " -f1 | rev)
git fetch origin $branch --unshallow >&2
commits_behind=$(git --no-pager log --oneline HEAD..origin/$branch)
[ -n "$commits_behind" ] && echo "$name has new commits upstream:\n$commits_behind" >&2
echo \
"$path\t" \
"$branch\t" \
"$(git rev-parse --short HEAD)\t" \
$(if [ -z "$commits_behind" ];
then echo "✅ up to date";
else echo "⚠️ $(echo "$commits_behind" | wc -l) commits behind origin/$branch";
fi)
' | column -t -s $'\t'
)
\`\`\`
$EOF