-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 2.08 KB
/
release.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
name: CI
on:
push:
branches:
- '**'
tags:
- '*'
pull_request:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Cache PlatformIO and pip
uses: actions/cache@v3
with:
path: |
~/.platformio
~/.cache/pip
key: ${{ runner.os }}-platformio-${{ hashFiles('**/platformio.ini') }}
restore-keys: |
${{ runner.os }}-platformio-
- name: Install dependencies
run: |
pip install urllib3==1.26.15
pip install -U platformio
pio pkg update
- name: Extract version from tag
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG=${GITHUB_REF#refs/tags/}
if [[ $TAG =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
echo "MAJOR_VERSION=${BASH_REMATCH[1]}" >> $GITHUB_ENV
echo "MINOR_VERSION=${BASH_REMATCH[2]}" >> $GITHUB_ENV
echo "PATCH_VERSION=${BASH_REMATCH[3]}" >> $GITHUB_ENV
else
echo "Tag does not match version pattern"
exit 1
fi
- name: Set default version if no tag
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: |
echo "MAJOR_VERSION=0" >> $GITHUB_ENV
echo "MINOR_VERSION=0" >> $GITHUB_ENV
echo "PATCH_VERSION=0" >> $GITHUB_ENV
- name: Build project
run: |
pio --version
pio run
- name: Generate SHA256 checksum
run: |
sha256sum .pio/build/ATtiny1616/firmware.hex | cut -d ' ' -f 1 > .pio/build/ATtiny1616/firmware.hex.sha256
- name: Upload release assets
if: startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
with:
artifacts: |
.pio/build/ATtiny1616/firmware.hex
.pio/build/ATtiny1616/firmware.hex.sha256
allowUpdates: true