-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (125 loc) · 5.43 KB
/
check-build-prerelease.yml
File metadata and controls
147 lines (125 loc) · 5.43 KB
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
name: Pre-release Check-Build Meshtastic Heltec Mesh Node t114 OLED_RU
on:
workflow_dispatch: # Manual trigger for testing
repository_dispatch: # Optional external trigger
types: [meshtastic-prerelease]
schedule:
- cron: "0 3 * * *" # Run daily to check for new prereleases
permissions:
contents: write
actions: read
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install PlatformIO
run: |
pip install -U pip
pip install platformio
- name: Fetch latest Meshtastic prerelease
id: get_release
run: |
# Get the first prerelease entry from the releases list
RELEASE_JSON=$(curl -s https://api.github.com/repos/meshtastic/firmware/releases | jq '[.[] | select(.prerelease==true)][0]')
LATEST_TAG=$(echo "$RELEASE_JSON" | jq -r .tag_name)
echo "Latest Meshtastic prerelease: $LATEST_TAG"
echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
echo "ru_tag=${LATEST_TAG}-ru" >> $GITHUB_OUTPUT
- name: Check if already built
id: check_release
run: |
if gh release view "${{ steps.get_release.outputs.ru_tag }}" >/dev/null 2>&1; then
echo "Release already exists. Skipping build."
echo "skip_build=true" >> $GITHUB_OUTPUT
else
echo "skip_build=false" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Stop job if already built
if: steps.check_release.outputs.skip_build == 'true'
run: exit 0
# - name: Clone Meshtastic firmware at latest prerelease
# if: steps.check_release.outputs.skip_build == 'false'
# run: |
# git clone --depth=1 --branch ${{ steps.get_release.outputs.tag }} https://github.com/meshtastic/firmware.git
# cd firmware
# git submodule update --init --recursive
- name: Checkout firmware at exact release tag
uses: actions/checkout@v4
with:
repository: meshtastic/firmware
ref: ${{ steps.get_release.outputs.tag }}
fetch-depth: 0
submodules: 'recursive'
path: firmware
- name: Verify checkout
run: |
cd firmware
echo "Requested tag: ${{ steps.get_release.outputs.tag }}"
git --no-pager show -s --format='HEAD=%H%nREFS=%D' HEAD
echo "git describe: $(git describe --tags --long --always || true)"
echo "Tags pointing at HEAD:"
git tag --points-at HEAD || true
echo "Submodule status:"
git submodule status --recursive || true
- name: Patch platformio.ini for OLED_RU
if: steps.check_release.outputs.skip_build == 'false'
run: |
sed -i '/-DHELTEC_T114/a\ -D OLED_RU' firmware/variants/nrf52840/heltec_mesh_node_t114/platformio.ini
cat firmware/variants/nrf52840/heltec_mesh_node_t114/platformio.ini
- name: Build Heltec Mesh Node t114 firmware
if: steps.check_release.outputs.skip_build == 'false'
run: |
cd firmware
pio run -e heltec-mesh-node-t114
- name: Rename binaries with versioned names
if: steps.check_release.outputs.skip_build == 'false'
run: |
cd firmware/.pio/build/heltec-mesh-node-t114
for f in *-t114-*.uf2; do [[ "$f" == *-t114-ru-* ]] && continue; mv -- "$f" "${f/-t114-/-t114-ru-}"; done
- name: Generate checksums
if: steps.check_release.outputs.skip_build == 'false'
id: checksum
run: |
cd firmware/.pio/build/heltec-mesh-node-t114
for f in heltec-mesh-node-t114-ru-*.uf2; do
sha256sum "$f" >> SHA256SUMS.txt
done
echo "Checksums generated:"
cat SHA256SUMS.txt
- name: Upload firmware binaries (Actions artifacts)
if: steps.check_release.outputs.skip_build == 'false'
uses: actions/upload-artifact@v4
with:
name: heltec-mesh-node-t114-${{ steps.get_release.outputs.ru_tag }}
path: |
firmware/.pio/build/heltec-mesh-node-t114/heltec-mesh-node-t114-ru-*.uf2
firmware/.pio/build/heltec-mesh-node-t114/SHA256SUMS.txt
- name: Publish GitHub Release
if: steps.check_release.outputs.skip_build == 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.get_release.outputs.ru_tag }}
name: Meshtastic Heltec Mesh Node t114 RU **Prerelease** ${{ steps.get_release.outputs.tag }}
body: |
⚠️ This is a **prerelease build** for **Heltec Mesh Node t114 OLED** with **RU support**
🔗 Based on upstream prerelease [${{ steps.get_release.outputs.tag }}](https://github.com/meshtastic/firmware/releases/tag/${{ steps.get_release.outputs.tag }})
**Checksums (SHA256):**
```
$(cat firmware/.pio/build/heltec-mesh-node-t114/SHA256SUMS.txt)
```
Firmware attached below 👇
prerelease: true
files: |
firmware/.pio/build/heltec-mesh-node-t114/heltec-mesh-node-t114-ru-*.uf2
firmware/.pio/build/heltec-mesh-node-t114/SHA256SUMS.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}