Files
lag2cn/.github/workflows/build.yml
T
TheWhiteDog9487 231e88e506 Update build.yml
2024-10-13 11:04:58 +08:00

55 lines
1.4 KiB
YAML

name: 更新二进制可执行文件
on:
workflow_dispatch:
push:
paths:
- "language.cpp"
# 只在源代码被更新时运行
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 安装GCC对ARM交叉编译工具链
run: sudo apt install g++-aarch64-linux-gnu
- name: 编译源代码
run: |
g++ -o language --static -std=c++20 language.cpp
aarch64-linux-gnu-g++ -o language_arm --static -std=c++20 language.cpp
# 静态链接,避免运行时才发现缺少so动态链接库
- uses: actions/upload-artifact@v4
with:
name: language_arm
path: language_arm
- uses: actions/upload-artifact@v4
with:
name: language
path: language
push:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
# 更新仓库需要写入权限
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: language
- uses: actions/download-artifact@v4
with:
name: language_arm
- name: 推送
run: |
git config --global user.email "gaojian520one@outlook.com"
git config --global user.name "TheWhiteDog9487"
git add .
git commit -m "新的二进制文件"
git push