-
Notifications
You must be signed in to change notification settings - Fork 3
110 lines (96 loc) · 4.36 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Build and create a release when tag is pushed
# Only deploy when a new tag is pushed
# git tag v0.n
# git push origin v0.n
on:
push:
tags:
- "v*.*-alpha"
- "v*.*.*"
- "v*.*"
# branches: [ main ]
# pull_request:
# branches: [ main ]
# Must match the project() name in CMakeLists.txt
env:
APP_NAME: picosmsPlus
# Allow this workflow to write back to the repository
permissions:
contents: write
# Build binaries and create release
jobs:
build-release:
runs-on: self-hosted
name: Build and create 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
- name: Check out this repository with submodules
uses: actions/checkout@v4
with:
submodules: recursive
- 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
arm-none-eabi-gcc --version
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
sed -i "s/VX.X/$tag/" menu.h
else
echo "The string does not start with 'refs/tags/'."
fi
grep "pico_set_program_version" CMakeLists.txt
grep SWVERSION menu.h
# - 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
# - name: Install picotool
# run: |
# cd $HOME && \
# export PICO_SDK_PATH=$HOME/pico-sdk && \
# git clone https://github.com/raspberrypi/picotool.git --branch master && \
# cd picotool/ && \
# mkdir build && \
# cd build && \
# cmake .. && \
# make
- name: Build all the .uf2 files
run: |
chmod +x build*.sh bld.sh || exit 1
export PICO_SDK_PATH=$HOME/pico2/pico-sdk
./buildAll.sh
# - name: Show release info using picotool
# run: |
# export PICO_SDK_PATH=$HOME/pico-sdk && \
# $HOME/picotool/build/picotool info releases/${{ env.APP_NAME }}AdaFruitDVISD.uf2 && \
# echo "-----------------------------" && \
# $HOME/picotool/build/picotool info releases/${{ env.APP_NAME }}FeatherDVI.uf2 && \
# echo "-----------------------------" && \
# $HOME/picotool/build/picotool info releases/${{ env.APP_NAME }}PimoroniDV.uf2 && \
# echo "-----------------------------" && \
# $HOME/picotool/build/picotool info releases/${{ env.APP_NAME }}WsRP2040PiZero.uf2
- name: Create release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
releases/${{ env.APP_NAME }}AdaFruitDVISD.uf2
releases/${{ env.APP_NAME }}FeatherDVI.uf2
releases/${{ env.APP_NAME }}PimoroniDV.uf2
releases/${{ env.APP_NAME }}WsRP2040PiZero.uf2
releases/pico2_${{ env.APP_NAME }}AdaFruitDVISD.uf2
releases/pico2_${{ env.APP_NAME }}PimoroniDV.uf2
PCB/pico_nesPCB_v2.0.zip
body_path: CHANGELOG.md