Skip to content

Commit 84cdb12

Browse files
committed
🐎 ci: 添加 release ci
Signed-off-by: xqyjlj <[email protected]>
1 parent 17a944a commit 84cdb12

File tree

4 files changed

+81
-3
lines changed

4 files changed

+81
-3
lines changed

.github/workflows/build.yml renamed to .github/workflows/build_release.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,23 @@
1313
# Copyright (C) 2025-2025 xqyjlj<[email protected]>
1414
#
1515
# @author xqyjlj
16-
# @file build.yml
16+
# @file build_release.yml
1717
#
1818
# Change Logs:
1919
# Date Author Notes
2020
# ------------ ---------- -----------------------------------------------
2121
# 2025-01-16 xqyjlj initial version
2222
#
2323

24-
name: 👷 build
24+
name: build_release
2525

2626
on:
2727
push:
2828
pull_request:
2929

3030
jobs:
31-
build_examples:
31+
build:
32+
name: 🧪 build
3233
runs-on: ubuntu-latest
3334
strategy:
3435
matrix:
@@ -92,3 +93,36 @@ jobs:
9293
with:
9394
name: artifact
9495
path: ${{ matrix.target }}/build.cmake/cross/arm
96+
release:
97+
name: ⬆️ release
98+
runs-on: ubuntu-latest
99+
needs: [ build ]
100+
if: startsWith(github.ref, 'refs/tags/')
101+
steps:
102+
- name: ⬇️ checkout csp_hal_apm32f1
103+
uses: actions/checkout@v4
104+
with:
105+
submodules: true
106+
107+
- name: ⬇️ init env packages
108+
shell: bash
109+
run: |
110+
sudo apt update
111+
sudo apt install 7zip
112+
113+
- name: 👷 deploy
114+
shell: bash
115+
run: |
116+
sed -i 's/latest/${{ github.ref_name }}/g' ./csp_hal_apm32f1.csppdsc
117+
source tools/deploy.sh && deploy csp_hal_apm32f1-${{ github.ref_name }}
118+
7z a -t7z -mx=9 -m0=lzma2 -mf=off csp_hal_apm32f1-${{ github.ref_name }}.csppack csp_hal_apm32f1-${{ github.ref_name }}
119+
120+
- name: ⬆️ create release
121+
uses: softprops/action-gh-release@v2
122+
with:
123+
name: csp_hal_apm32f1 ${{ github.ref_name }}
124+
draft: true
125+
prerelease: true
126+
token: ${{ secrets.RELEASE_TOKEN }}
127+
files: |
128+
csp_hal_apm32f1-${{ github.ref_name }}.csppack

README-zh_CN.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
</a>
55
<h1>CSP HAL APM32F1</h1>
66
<div>
7+
<a href="https://github.com/csplink/csp_hal_apm32f1/actions?query=workflow/build_release.yml">
8+
<img src="https://img.shields.io/github/actions/workflow/status/csplink/csp_hal_apm32f1/build_release.yml?style=flat&label=build_release" alt="github-ci" />
9+
</a>
710
<a href="https://github.com/csplink/csp_hal_apm32f1/actions?query=workflow/mirror.yml">
811
<img src="https://img.shields.io/github/actions/workflow/status/csplink/csp_hal_apm32f1/mirror.yml?style=flat&label=mirror" alt="github-ci" />
912
</a>

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
</a>
55
<h1>CSP HAL APM32F1</h1>
66
<div>
7+
<a href="https://github.com/csplink/csp_hal_apm32f1/actions?query=workflow/build_release.yml">
8+
<img src="https://img.shields.io/github/actions/workflow/status/csplink/csp_hal_apm32f1/build_release.yml?style=flat&label=build_release" alt="github-ci" />
9+
</a>
710
<a href="https://github.com/csplink/csp_hal_apm32f1/actions?query=workflow/mirror.yml">
811
<img src="https://img.shields.io/github/actions/workflow/status/csplink/csp_hal_apm32f1/mirror.yml?style=flat&label=mirror" alt="github-ci" />
912
</a>

tools/deploy.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# Licensed under the GNU General Public License v. 3 (the "License")
4+
# You may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.gnu.org/licenses/gpl-3.0.html
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# Copyright (C) 2025-2025 xqyjlj<[email protected]>
16+
#
17+
# @author xqyjlj
18+
# @file deploy.sh
19+
#
20+
# Change Logs:
21+
# Date Author Notes
22+
# ------------ ---------- -----------------------------------------------
23+
# 2025-01-19 xqyjlj initial version
24+
#
25+
26+
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
27+
28+
function deploy {
29+
path=${1}
30+
31+
pushd "${script_dir}"/..
32+
33+
rm -rfv ${path}
34+
mkdir -pv ${path}
35+
rsync -av --exclude='.git' --exclude=${path} . ${path}/
36+
37+
popd
38+
}

0 commit comments

Comments
 (0)