Files
lag2cn/.github/workflows/build.yml
T

64 lines
1.6 KiB
YAML

name: 更新二进制可执行文件
on:
workflow_dispatch:
push:
paths:
- "language.cpp"
# 只在源代码被更新时运行
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-linux-musl
artifact: language
- target: aarch64-linux-musl
artifact: language_arm
steps:
- uses: actions/checkout@v6
- name: 下载 musl 工具链
uses: lmq8267/dl-musl@main
with:
TARGET: ${{ matrix.target }}
STATIC: true
- name: 编译
run: |
if [ "${{ matrix.target }}" = "x86_64-linux-musl" ]; then
"$CXX" -o "${{ matrix.artifact }}" -std=c++23 -s language.cpp
else
"$CXX" -o "${{ matrix.artifact }}" -std=c++23 -s language.cpp
fi
- uses: actions/upload-artifact@v5
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}
push:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
# 更新仓库需要写入权限
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v6
with:
name: language
- uses: actions/download-artifact@v6
with:
name: language_arm
- name: 推送
run: |
git config --global user.email "thewhitedog9487@outlook.com"
git config --global user.name "TheWhiteDog9487"
git add .
git commit -m "新的二进制文件"
git push