Skip to content

Commit 95b7e99

Browse files
committed
add github workflows and action
1 parent c0a93f2 commit 95b7e99

File tree

5 files changed

+181
-0
lines changed

5 files changed

+181
-0
lines changed

.github/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
!actions/*
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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: Build and Rename
8+
9+
inputs:
10+
path:
11+
required: true
12+
build:
13+
required: false
14+
default: build
15+
platform:
16+
required: false
17+
default: rp2040
18+
board:
19+
required: false
20+
default: pico
21+
identifier:
22+
required: true
23+
output_path:
24+
required: false
25+
default: Release
26+
27+
runs:
28+
using: 'composite'
29+
steps:
30+
- name: Build
31+
uses: elehobica/build-pico@v1
32+
with:
33+
path: ${{ inputs.path }}
34+
build: ${{ inputs.build }}
35+
platform: ${{ inputs.platform }}
36+
board: ${{ inputs.board }}
37+
- name: Move artifacts
38+
uses: elehobica/add-identifier@v1
39+
with:
40+
paths: ${{ inputs.path }}/${{ inputs.build }}
41+
exts: .uf2 .elf
42+
identifier: ${{ inputs.identifier }}
43+
output_path: ${{ inputs.output_path }}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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: Build
8+
9+
on: [push, pull_request]
10+
11+
jobs:
12+
build-sine-wave-i2s_32b:
13+
runs-on: ubuntu-latest
14+
env:
15+
PROJECT_DIR: samples/sine_wave_i2s_32b
16+
RELEASE_DIR: Release
17+
outputs:
18+
release-tag-condition-matched: ${{ steps.release-tag-condition.outputs.matched }}
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Build Pico
23+
uses: ./.github/actions/build-and-rename
24+
with:
25+
path: ${{ env.PROJECT_DIR }}
26+
build: build
27+
identifier: pico
28+
output_path: ${{ env.RELEASE_DIR }}
29+
- name: Build Pico 2
30+
uses: ./.github/actions/build-and-rename
31+
with:
32+
path: ${{ env.PROJECT_DIR }}
33+
build: build2
34+
platform: rp2350
35+
board: pico2
36+
identifier: pico2
37+
output_path: ${{ env.RELEASE_DIR }}
38+
- name: Upload production artifacts
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: dist-binaries0
42+
path: |
43+
${{ env.RELEASE_DIR }}/*.uf2
44+
${{ env.RELEASE_DIR }}/*.elf
45+
46+
release-tag-condition:
47+
runs-on: ubuntu-latest
48+
outputs:
49+
matched: ${{ steps.check.outputs.matched }}
50+
steps:
51+
- name: Check if Release Tag Condition Matched
52+
id: check
53+
run: |
54+
if [[ ${{ github.ref_type }} == 'tag' && ${{ github.ref_name }} =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]; then
55+
echo "matched=true" >> $GITHUB_OUTPUT
56+
echo "Release tag condition matched"
57+
else
58+
echo "matched=false" >> $GITHUB_OUTPUT
59+
echo "Release tag condition not matched"
60+
fi
61+
62+
call-upload-release-asset:
63+
needs: [build-sine-wave-i2s_32b, release-tag-condition]
64+
if: ${{ needs.release-tag-condition.outputs.matched == 'true' }}
65+
uses: ./.github/workflows/upload-release-asset.yml
66+
with:
67+
source_run_id: ${{ github.run_id }}
68+
artifacts_dirs: "dist-binaries0"
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
artifacts_dirs:
17+
description: 'The directories of the artifacts'
18+
type: string
19+
required: true
20+
21+
jobs:
22+
upload-release-asset:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: write
26+
checks: write
27+
env:
28+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
CHANGELOG: ./CHANGELOG.md
30+
RELEAESE_NOTE: ./ReleaseNote.md
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
- name: Extract Release Note from CHANGELOG
35+
run: |
36+
pattern1="^## \[${{ github.ref_name }}\]"
37+
pattern2="^## \["
38+
print=false
39+
while read line; do
40+
if [[ $line =~ $pattern1 ]]; then
41+
print=true
42+
elif [[ $line =~ $pattern2 ]]; then
43+
print=false
44+
elif $print; then
45+
echo "$line" >> ${{ env.RELEAESE_NOTE }}
46+
fi
47+
done < ${{ env.CHANGELOG }}
48+
- name: Create Release as Draft
49+
id: create-release
50+
run: |
51+
gh release create ${{ github.ref_name }} \
52+
--title "Release ${{ github.ref_name }}" \
53+
--notes-file ${{ env.RELEAESE_NOTE}} \
54+
--draft \
55+
--target ${{ github.sha }}
56+
- name: Download Artifacts
57+
id: download-artifacts
58+
run: |
59+
gh run download ${{ inputs.source_run_id }}
60+
- name: Upload Release Assets
61+
id: upload-release-assets
62+
run: |
63+
for dir in ${{ inputs.artifacts_dirs }}; do
64+
for file in $(ls $dir/*.uf2 $dir/*.elf); do
65+
gh release upload ${{ github.ref_name }} "$file"
66+
done
67+
done

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
8+
## [10.1.2] - 2025-03-03
89
### Added
910
* Confirm with pico-sdk 2.1.1
1011
* Support Raspberry Pi Pico 2 board

0 commit comments

Comments
 (0)