Skip to content

Commit 2c690d1

Browse files
authored
Merge pull request #13 from elehobica/upload-release-asset
Upload release asset
2 parents 1c4ba27 + 8f94a40 commit 2c690d1

7 files changed

Lines changed: 228 additions & 19 deletions

File tree

.github/actions/build-and-rename/action.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ runs:
3030
- name: Build
3131
uses: elehobica/build-pico@v1
3232
with:
33-
path: ${{inputs.path}}
34-
build: ${{inputs.build}}
35-
platform: ${{inputs.platform}}
36-
board: ${{inputs.board}}
33+
path: ${{ inputs.path }}
34+
build: ${{ inputs.build }}
35+
platform: ${{ inputs.platform }}
36+
board: ${{ inputs.board }}
3737
- name: Move artifacts
3838
uses: elehobica/add-identifier@v1
3939
with:
40-
paths: ${{inputs.build}}
40+
paths: ${{ inputs.build }}
4141
exts: .uf2 .elf
42-
identifier: ${{inputs.identifier}}
43-
output_path: ${{inputs.output_path}}
42+
identifier: ${{ inputs.identifier }}
43+
output_path: ${{ inputs.output_path }}

.github/actions/set-version/dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27571,7 +27571,7 @@ try {
2757127571
let text = fs.readFileSync(targetFile, 'utf-8');
2757227572
let version_str = core.getInput('version_str', {required: true});
2757327573
let version_str_size = core.getInput('version_str_size', {required: true});
27574-
version_str = version_str.length > version_str_size ? version_str.slice(0, version_str_size - 1) : version_str;
27574+
version_str = version_str.length > version_str_size ? version_str.slice(0, version_str_size) : version_str;
2757527575
fs.writeFileSync(targetFile, text.replace(/("CFG_VERSION",\s+)"\d\.\d\.\d"/, `$1"${version_str}"`));
2757627576
} catch (error) {
2757727577
core.setFailed(error.message);
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
@actions/core
2+
MIT
3+
The MIT License (MIT)
4+
5+
Copyright 2019 GitHub
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8+
9+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10+
11+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12+
13+
@actions/exec
14+
MIT
15+
The MIT License (MIT)
16+
17+
Copyright 2019 GitHub
18+
19+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
20+
21+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
22+
23+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24+
25+
@actions/http-client
26+
MIT
27+
Actions Http Client for Node.js
28+
29+
Copyright (c) GitHub, Inc.
30+
31+
All rights reserved.
32+
33+
MIT License
34+
35+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
36+
associated documentation files (the "Software"), to deal in the Software without restriction,
37+
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
38+
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
39+
subject to the following conditions:
40+
41+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
42+
43+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
44+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
45+
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
46+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
47+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
48+
49+
50+
@actions/io
51+
MIT
52+
The MIT License (MIT)
53+
54+
Copyright 2019 GitHub
55+
56+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
57+
58+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
59+
60+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
61+
62+
@fastify/busboy
63+
MIT
64+
Copyright Brian White. All rights reserved.
65+
66+
Permission is hereby granted, free of charge, to any person obtaining a copy
67+
of this software and associated documentation files (the "Software"), to
68+
deal in the Software without restriction, including without limitation the
69+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
70+
sell copies of the Software, and to permit persons to whom the Software is
71+
furnished to do so, subject to the following conditions:
72+
73+
The above copyright notice and this permission notice shall be included in
74+
all copies or substantial portions of the Software.
75+
76+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
77+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
78+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
79+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
80+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
81+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
82+
IN THE SOFTWARE.
83+
84+
tunnel
85+
MIT
86+
The MIT License (MIT)
87+
88+
Copyright (c) 2012 Koichi Kobayashi
89+
90+
Permission is hereby granted, free of charge, to any person obtaining a copy
91+
of this software and associated documentation files (the "Software"), to deal
92+
in the Software without restriction, including without limitation the rights
93+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
94+
copies of the Software, and to permit persons to whom the Software is
95+
furnished to do so, subject to the following conditions:
96+
97+
The above copyright notice and this permission notice shall be included in
98+
all copies or substantial portions of the Software.
99+
100+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
101+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
102+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
103+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
104+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
105+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
106+
THE SOFTWARE.
107+
108+
109+
undici
110+
MIT
111+
MIT License
112+
113+
Copyright (c) Matteo Collina and Undici contributors
114+
115+
Permission is hereby granted, free of charge, to any person obtaining a copy
116+
of this software and associated documentation files (the "Software"), to deal
117+
in the Software without restriction, including without limitation the rights
118+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
119+
copies of the Software, and to permit persons to whom the Software is
120+
furnished to do so, subject to the following conditions:
121+
122+
The above copyright notice and this permission notice shall be included in all
123+
copies or substantial portions of the Software.
124+
125+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
126+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
127+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
128+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
129+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
130+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
131+
SOFTWARE.

.github/actions/set-version/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*-----------------------------------------------------------/
2-
/ index.js
2+
/ set-version/index.js
33
/------------------------------------------------------------/
44
/ Copyright (c) 2025, Elehobica
55
/ Released under the BSD-2-Clause
@@ -14,7 +14,7 @@ try {
1414
let text = fs.readFileSync(targetFile, 'utf-8');
1515
let version_str = core.getInput('version_str', {required: true});
1616
let version_str_size = core.getInput('version_str_size', {required: true});
17-
version_str = version_str.length > version_str_size ? version_str.slice(0, version_str_size - 1) : version_str;
17+
version_str = version_str.length > version_str_size ? version_str.slice(0, version_str_size) : version_str;
1818
fs.writeFileSync(targetFile, text.replace(/("CFG_VERSION",\s+)"\d\.\d\.\d"/, `$1"${version_str}"`));
1919
} catch (error) {
2020
core.setFailed(error.message);

.github/workflows/build-binaries.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
env:
1515
RELEASE_DIR: Release
16+
VERSION_LENGTH: 15
1617
steps:
1718
- name: Checkout
1819
uses: actions/checkout@v4
@@ -21,24 +22,29 @@ jobs:
2122
- name: Generate version stirng
2223
id: generate-version-string
2324
run: |
24-
if [[ ${{github.ref_type}} == 'branch' ]]; then
25-
ref_name=${{github.ref_name}}
26-
echo "value=${ref_name:0:8}-${{github.run_number}}" >> $GITHUB_OUTPUT
25+
ref_name=${{ github.ref_name }}
26+
if [[ ${{ github.ref_type }} == 'branch' ]]; then
27+
run_number=-${{ github.run_number }}
28+
run_number_length=${#run_number}
29+
ref_max_length=$((${{ env.VERSION_LENGTH }} - run_number_length))
2730
else
28-
echo 'value=${{github.ref_name}}' >> $GITHUB_OUTPUT
31+
run_number=
32+
ref_max_length=${{ env.VERSION_LENGTH }}
2933
fi
34+
echo "value=${ref_name:0:$ref_max_length}${run_number}" >> $GITHUB_OUTPUT
3035
- name: Set Version
3136
uses: ./.github/actions/set-version
3237
with:
3338
target: src/ConfigParam.h
34-
version_str: ${{steps.generate-version-string.outputs.value}}
39+
version_str: ${{ steps.generate-version-string.outputs.value }}
40+
version_str_size: ${{ env.VERSION_LENGTH }}
3541
- name: Build Pico
3642
uses: ./.github/actions/build-and-rename
3743
with:
3844
path: .
3945
build: build
4046
identifier: pico
41-
output_path: ${{env.RELEASE_DIR}}
47+
output_path: ${{ env.RELEASE_DIR }}
4248
- name: Build Pico 2
4349
uses: ./.github/actions/build-and-rename
4450
with:
@@ -47,11 +53,18 @@ jobs:
4753
platform: rp2350
4854
board: pico2
4955
identifier: pico2
50-
output_path: ${{env.RELEASE_DIR}}
56+
output_path: ${{ env.RELEASE_DIR }}
5157
- name: Upload production artifacts
5258
uses: actions/upload-artifact@v4
5359
with:
5460
name: dist-binaries
5561
path: |
56-
${{env.RELEASE_DIR}}/*.uf2
57-
${{env.RELEASE_DIR}}/*.elf
62+
${{ env.RELEASE_DIR }}/*.uf2
63+
${{ env.RELEASE_DIR }}/*.elf
64+
65+
upload-release-asset:
66+
needs: [build-and-upload]
67+
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
68+
uses: ./.github/workflows/upload-release-asset.yml
69+
with:
70+
source_run_id: ${{ github.run_id }}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#------------------------------------------------------
2+
# Copyright (c) 2025, Elehobica
3+
# Released under the BSD-2-Clause
4+
# refer to https://opensource.org/licenses/BSD-2-Clause
5+
#------------------------------------------------------
6+
7+
name: Upload Release Asset
8+
9+
on:
10+
workflow_call:
11+
inputs:
12+
source_run_id:
13+
description: 'The run ID of the source workflow'
14+
type: string
15+
required: true
16+
17+
jobs:
18+
upload-release-asset:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
checks: write
23+
env:
24+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
CHANGELOG: ./CHANGELOG.md
26+
RELEAESE_NOTE: ./ReleaseNote.md
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
- name: Extract Release Note from CHANGELOG
31+
run: |
32+
pattern1="^## \[${{ github.ref_name }}\]"
33+
pattern2="^## \["
34+
print=false
35+
while read line; do
36+
if [[ $line =~ $pattern1 ]]; then
37+
print=true
38+
elif [[ $line =~ $pattern2 ]]; then
39+
print=false
40+
elif $print; then
41+
echo "$line" >> ${{ env.RELEAESE_NOTE }}
42+
fi
43+
done < ${{ env.CHANGELOG }}
44+
- name: Create Release as Draft
45+
id: create-release
46+
run: |
47+
gh release create ${{ github.ref_name }} \
48+
--title "Release ${{ github.ref_name }}" \
49+
--notes-file ${{ env.RELEAESE_NOTE}} \
50+
--notes "Changes in this Release\n- 1\n- First Change\n- Second Change" \
51+
--draft \
52+
--target ${{ github.sha }}
53+
- name: Download Artifacts
54+
uses: actions/download-artifact@v4
55+
with:
56+
name: dist-binaries
57+
github-token: ${{ env.GH_TOKEN }}
58+
run-id: ${{ inputs.source_run_id }}
59+
- name: Upload Release Asset
60+
id: upload-release-asset
61+
run: |
62+
for file in $(ls *.uf2 *.elf); do
63+
gh release upload ${{ github.ref_name }} "$file"
64+
done

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88
### Added
99
* Add support of Waveshare RP2350-LCD-0.96 board
1010
* Add workflow to build binaries
11+
* Add workflow to generate the draft of Release Note
1112

1213
## [v0.9.6] - 2025-03-06
1314
### Added

0 commit comments

Comments
 (0)