This repository was archived by the owner on Jul 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
70 lines (54 loc) · 1.93 KB
/
build_release.yml
File metadata and controls
70 lines (54 loc) · 1.93 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
name: Build and release
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Arduino CLI
uses: arduino/setup-arduino-cli@v1
- name: Install core/libs
run: |
arduino-cli core update-index
arduino-cli core install "arduino:avr"
arduino-cli lib install "FastLED@3.4.0" "Adafruit BMP280 Library@2.3.0"
- name: Compile configs
run: ./build.sh --all
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: build
path: build
check_version:
runs-on: ubuntu-latest
steps:
- name: Chackout
uses: actions/checkout@v2
- name: Check version
run: |
git fetch --tags
file_ver=$(awk '/VERSION:/ {print $3}' LEDController.ino)
ch_ver=$(awk -F'[][]' '/\[v[0-9.]+\]/ {print $2; exit}' CHANGELOG.md)
git_vers=$(git describe --tags --always $(git rev-list --tags))
echo "Latest git tag: ${git_vers%%$'\n'*}"
echo "File version: ${file_ver}"
echo "Changelog version: ${ch_ver}"
if [[ $file_ver != $ch_ver || $git_vers =~ $file_ver ]]; then echo "Version issue!"; exit 1; fi
release:
needs: [build, check_version]
if: ${{ github.ref_name == 'main' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- name: Generate changelog
run: awk '/^## / {if (p) {exit}; {p=1}} p' CHANGELOG.md > latest-CHANGELOG.md
- name: Get version
run: echo "version=$(awk '/VERSION:/ {print $3}' LEDController.ino)" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.version }}
body_path: latest-CHANGELOG.md
files: build/*