-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (83 loc) · 2.71 KB
/
build.yaml
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
name: OpenDTU Build
on:
schedule:
- cron: '0 3 * * *'
push:
branches:
- main
env:
GIT_CLONE_URL: https://github.com/tbnobody/OpenDTU.git
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: opendtu_release
name: Get OpenDTU release
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: tbnobody
repo: OpenDTU
excludes: prerelease, draft
- id: last_build
name: Get lastest Build
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: LucaDev
repo: OpenDTU-Build
excludes: prerelease, draft
- name: cancel run if same versions
if: steps.last_build.outputs.release == steps.opendtu_release.outputs.release
uses: andymckay/[email protected]
- name: Clone OpenDTU
run: git clone $GIT_CLONE_URL opendtu
- name: Get Version
id: get_version
run: |
cd opendtu
git fetch --tags
export TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $TAG
echo "TAG=$TAG" >> $GITHUB_ENV
echo "COMMIT=$(git log --format="%h" -n 1)" >> $GITHUB_ENV
echo 'patches<<EOF' >> $GITHUB_OUTPUT
echo "$(ls -1 ../patches/*.patch)" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Patch
run: |
cd opendtu
git apply ../patches/*.patch
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install PlatformIO Core
run: pip install --upgrade setuptools platformio
- name: Build PlatformIO Project
run: |
cd opendtu
pio run -e lolin_s2_mini
- uses: actions/create-release@master
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_name: ${{ steps.opendtu_release.outputs.release }}
tag_name: ${{ steps.opendtu_release.outputs.release }}
body: |
OpenDTU commit ${{ env.COMMIT }}
Patches:
${{ steps.get_version.outputs.patches }}
- uses: actions/upload-release-asset@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./opendtu/.pio/build/lolin_s2_mini/firmware.bin
asset_name: opendtu-lolin_s2_mini.bin
asset_content_type: application/octet-stream