-
Notifications
You must be signed in to change notification settings - Fork 2
246 lines (213 loc) · 7.7 KB
/
release.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
name: USBSID-Pico Release
env:
BUILD_THREADS: 4
BUILD_TYPE: Release
# Pico-SDK version
PICO_SDK_REF: 2.0.0
PICO_EXTRAS_REF: sdk-2.0.0
PICOTOOL_REF: 2.0.0
on:
push:
branches: [master]
tags:
- "*"
# Allows you to run this workflow manually from the Actions tab when needed
# workflow_dispatch:
jobs:
release:
name: Create release files
runs-on: ubuntu-latest
permissions:
contents: write
needs: build
# job will only start if there is a new tag
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Branch latest
id: branch_name
run: |
echo "IS_TAG=${{ startsWith(github.ref, 'refs/tags/') }}" >> $GITHUB_OUTPUT
echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: 📇 Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 0
# path: master
- name: Generate release notes
env:
IS_TAG: ${{ steps.branch_name.outputs.IS_TAG }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
if: "${{ env.IS_TAG == 'true' }}"
id: release-notes
run: |
echo "**Commits in this release:**" > release_notes.md
git log $(git tag --sort version:refname | tail -n 2 | head -n 1)..HEAD --oneline >> release_notes.md
- name: Download all archived artifacts
env:
IS_TAG: ${{ steps.branch_name.outputs.IS_TAG }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
if: "${{ env.IS_TAG == 'true' }}"
uses: actions/download-artifact@v4 # https://github.com/actions/download-artifact
with:
path: release
pattern: releasebuild-usbsid*
merge-multiple: true
- name: View folder content
env:
IS_TAG: ${{ steps.branch_name.outputs.IS_TAG }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
if: "${{ env.IS_TAG == 'true' }}"
run: ls -R
- name: Create tagged release
id: create_release
env:
IS_TAG: ${{ steps.branch_name.outputs.IS_TAG }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
if: "${{ env.IS_TAG == 'true' }}"
uses: ncipollo/release-action@v1 # https://github.com/ncipollo/release-action
with:
tag: ${{ env.SOURCE_TAG }}
name: ${{ env.SOURCE_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "release/*.uf2"
prerelease: false
removeArtifacts: true
generateReleaseNotes: true
bodyFile: "release_notes.md"
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
include:
- {
buildname: Pico,
directory: pico,
pico_board: pico,
pico_platform: rp2040,
}
- {
buildname: Pico_W,
directory: picow,
pico_board: pico_w,
pico_platform: rp2040,
}
- {
buildname: Pico2,
directory: pico2,
pico_board: pico2,
pico_platform: rp2350-arm-s,
}
fail-fast: false
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: 🛠️ Arm GNU Toolchain (arm-none-eabi-gcc)
uses: carlosperate/arm-none-eabi-gcc-action@v1
- name: Install Act dependencies
if: ${{ env.ACT }}
run: |
apt-get update && apt-get install sudo -y
- name: Install dependencies
if: ${{ env.ACT }}
run: |
sudo apt-get update && sudo apt-get install curl build-essential cmake -y
- name: 🗒️ Check GCC Version
id: compiler-version
run: |
arm-none-eabi-gcc --version
ver=$(arm-none-eabi-gcc --version | head -1)
echo "CC_VERSION=$ver" >> $GITHUB_OUTPUT
- name: 💽 Cache Pico-SDK
id: cache-pico-sdk
uses: actions/cache@v4
with:
path: pico-sdk
key: ${{runner.os}}-pico-sdk-${{env.PICO_SDK_REF}}
- name: 📇 Checkout Pico-SDK
if: ${{steps.cache-pico-sdk.outputs.cache-hit != 'true' }}
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-sdk
ref: ${{env.PICO_SDK_REF}}
path: pico-sdk
submodules: recursive
- name: 🔖 Add PICO_SDK_PATH to Environment
run: |
echo "PICO_SDK_PATH=${{github.workspace}}/pico-sdk" >> $GITHUB_ENV
cd pico-sdk/lib/tinyusb
git checkout master
git pull
python3 tools/get_deps.py rp2040
- name: 💽 Cache Pico-Extras
id: cache-pico-extras
uses: actions/cache@v4
with:
path: pico-extras
key: ${{runner.os}}-pico-extras-${{env.PICO_EXTRAS_REF}}
- name: 📇 Checkout Pico-Extras
if: ${{steps.cache-pico-extras.outputs.cache-hit != 'true' }}
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-extras
ref: ${{env.PICO_EXTRAS_REF}}
path: pico-extras
submodules: recursive
- name: 🔖 Add PICO_EXTRAS_PATH to Environment
run: |
echo "PICO_EXTRAS_PATH=${{github.workspace}}/pico-extras" >> $GITHUB_ENV
ls pico-extras/external -la
- name: 💽 Cache picotool
id: cache-picotool
uses: actions/cache@v4
with:
path: picotool
key: ${{runner.os}}-picotool-${{env.PICOTOOL_REF}}
- name: 📇 Checkout picotool
if: ${{steps.cache-picotool.outputs.cache-hit != 'true' }}
uses: actions/checkout@v4
with:
repository: raspberrypi/picotool
ref: ${{env.PICOTOOL_REF}}
path: picotool-src
submodules: recursive
- name: 🏭 Build picotool
if: ${{steps.cache-picotool.outputs.cache-hit != 'true' }}
run: |
cmake -S picotool-src -B picotool-src/build -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/picotool -DPICOTOOL_FLAT_INSTALL=1
cd picotool-src/build
make -j ${{env.BUILD_THREADS}} install
- name: 📇 Checkout project
uses: actions/checkout@v4
with:
path: master
- name: 🏭 Create build folders
run: |
mkdir -p ${{github.workspace}}/master/build_${{matrix.directory}}
- name: 🏭 Setup CMAKE
run: |
unset PICO_PLATFORM
unset PICO_BOARD
cmake -S master -B ${{github.workspace}}/master/build_${{matrix.directory}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPICO_PLATFORM=${{matrix.pico_platform}} -DPICO_BOARD=${{matrix.pico_board}} -Dpicotool_DIR=${{github.workspace}}/picotool/picotool $extra_arg
- name: 🏭 Build ${{matrix.name}}
run: |
cmake --build ${{github.workspace}}/master/build_${{matrix.directory}} --config ${{env.BUILD_TYPE}} -j ${{env.BUILD_THREADS}}
- name: List build files
run: |
ls ${{github.workspace}}/master/build_${{matrix.directory}}/*.uf2 -la
- name: 💾 Gather Artifact Files
working-directory: ${{github.workspace}}/master
run: |
mkdir dist
cp -av build_${{matrix.directory}}/*.uf2 dist/
- name: Get current branch
run: |
echo "BRANCHNAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- name: Get current datetime
run: |
echo "DATETIME=$(date +'%Y%m%dT%H%M%S')" >> $GITHUB_ENV
- name: 💾 Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: releasebuild-usbsid${{matrix.pico_board}}
path: ${{github.workspace}}/master/dist