feat: Automatically build package and upload binary files to the issu… #1699
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linux | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: 下载submodule源码 | |
run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init | |
- name: apt-get安装依赖库(非必选) | |
run: sudo apt-get update && sudo apt-get install -y cmake libssl-dev libsdl-dev libavcodec-dev libavutil-dev libswscale-dev libresample-dev libusrsctp-dev | |
- name: 下载 SRTP | |
uses: actions/checkout@v2 | |
with: | |
repository: cisco/libsrtp | |
fetch-depth: 1 | |
ref: v2.3.0 | |
path: 3rdpart/libsrtp | |
- name: 编译 SRTP | |
run: cd 3rdpart/libsrtp && ./configure --enable-openssl && make -j $(nproc) && sudo make install | |
- name: 编译 | |
run: mkdir -p linux_build && cd linux_build && cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_FFMPEG=true && make -j $(nproc) | |
- name: 设置环境变量 | |
run: | | |
echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr -s "/\?%*:|\"<>" "_")" >> $GITHUB_ENV | |
echo "BRANCH2=$(echo ${GITHUB_REF#refs/heads/} )" >> $GITHUB_ENV | |
echo "DATE=$(date +%Y-%m-%d)" >> $GITHUB_ENV | |
- name: 打包二进制 | |
id: upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.workflow }}_${{ env.BRANCH }}_${{ env.DATE }}_${{ env.OS }} | |
path: release/* | |
if-no-files-found: error | |
retention-days: 1 | |
- name: issue评论 | |
if: github.event_name != 'pull_request' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: 483, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '- 下载地址: [${{ github.workflow }}_${{ env.BRANCH }}_${{ env.DATE }}](${{ steps.upload.outputs.artifact-url }})\n' | |
+ '- 分支: ${{ env.BRANCH2 }}\n' | |
+ '- git hash: ${{ github.sha }} \n' | |
+ '- 编译日期: ${{ env.DATE }}\n' | |
+ '- 打包ci名: ${{ github.workflow }}\n' | |
+ '- 说明: 本二进制在ubuntu-20.04上编译,请确保您的机器系统不低于此版本,并提前`sudo apt-get install -y cmake libssl-dev libsdl-dev libavcodec-dev libavutil-dev libswscale-dev libresample-dev libusrsctp-dev`安装依赖项\n' | |
}) |