-
Notifications
You must be signed in to change notification settings - Fork 326
59 lines (55 loc) · 1.82 KB
/
main.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
name: PlatformIO CI
on:
push:
branches:
- master
- dev
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version_step.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install PlatformIO Core
run: pip install --upgrade platformio
- name: Build PlatformIO Project
run: pio run
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: builded-binaries-${{ github.sha }}
path: .pio/build/*/*.bin
if-no-files-found: error
- name: Get version
id: version_step
run: echo "version=`cat src/version.h | grep CURRENT_VERSION | awk -F\\" '{print $2}'`" >> $GITHUB_OUTPUT
prerelease:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev'
steps:
- name: Download binaries
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/binaries
name: builded-binaries-${{ github.sha }}
- name: Rename binaries
run: find ${{ github.workspace }}/binaries -maxdepth 3 -type f -name "*.bin" -exec sh -c 'cp "$0" "${{ github.workspace }}/binaries/$(basename $(dirname "$0"))_$(basename $0)"' {} \;
- name: Pre-release
uses: softprops/action-gh-release@v2
with:
name: nerdminer-prerelease-${{ needs.build.outputs.version }}
tag_name: nerdminer-prerelease-${{ needs.build.outputs.version }}
prerelease: true
fail_on_unmatched_files: true
files: ${{ github.workspace }}/binaries/*.bin