-
Notifications
You must be signed in to change notification settings - Fork 5
93 lines (78 loc) · 3.46 KB
/
BuildAndRelease.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
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
name: Build and create a release when tag is pushed
# Only deploy when a new tag is pushed
on:
push:
tags:
- "v*.*-alpha"
- "v*.*.*"
# branches: [ master ]
# pull_request:
# branches: [ master ]
# Must match the project() name in CMakeLists.txt
env:
APP_NAME: dendy
# Allow this workflow to write back to the repository
permissions:
contents: write
# Build binary and send to releases
jobs:
build-release:
runs-on: ubuntu-latest
name: Build and release
steps:
- name: Install dependencies
run: |
sudo apt update && \
sudo apt install -y git python3 && \
sudo apt install -y cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential libusb-1.0-0-dev && \
sudo apt install -y ninja-build
- name: Check out this repository
uses: actions/checkout@v3
- name: Print Working directory
run: echo $HOME && pwd && ls -la
- name: Update line containing pico_set_program_version() in CMakelists.txt with tag name.
run: |
# Extract the tag name that triggered the event and remove the 'refs/tags/' prefix
input_string=${{ github.ref }}
prefix="refs/tags/"
tag="No versioninfo found"
if [[ $input_string == $prefix* ]]; then
echo "The string starts with 'refs/tags/'."
tag="${input_string#$prefix}"
echo "Tag is ${tag}"
sed -i "s/^[[:space:]]*pico_set_program_version(.*/pico_set_program_version(${{ env.APP_NAME }} \"$tag\")/" CMakeLists.txt
else
echo "The string does not start with 'refs/tags/'."
fi
grep "pico_set_program_version" CMakeLists.txt
- name: Install Pico SDk
run: |
cd $HOME && \
git clone https://github.com/raspberrypi/pico-sdk.git --branch master && \
cd pico-sdk/ && \
git submodule update --init && \
git fetch origin master && git checkout master && git pull
# cd lib/tinyusb &&
# git checkout 08f9ed67c92421cbd0bc09270d2f363886681866
- name: Build the project
run: |
export PICO_SDK_PATH=$HOME/pico-sdk && \
mkdir build && cd build && echo DEFAULT &&\
cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel .. && cmake --build . &&\
cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DI2S_SOUND=ON .. && cmake --build . &&\
cd .. && rm -rf build && mkdir build && cd build && echo TFT &&\
cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DTFT=ON .. && cmake --build . &&\
cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DTFT=ON -DI2S_SOUND=ON .. && cmake --build . &&\
cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DTFT=ON -DILI9341=ON -DI2S_SOUND=OFF.. && cmake --build . &&\
cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DTFT=ON -DILI9341=ON -DI2S_SOUND=ON .. && cmake --build . &&\
cd .. && rm -rf build && mkdir build && cd build && echo HDMI &&\
cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DHDMI=ON .. && cmake --build . &&\
cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DHDMI=ON -DI2S_SOUND=ON .. && cmake --build . &&\
echo done
- name: Create release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
bin/MinSizeRel/**.uf2
body_path: CHANGELOG.md