From e0963189906729d54f533e519a8caaa6d71586a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=97=E6=B5=A6=E6=9C=88?= Date: Sat, 6 Apr 2024 13:56:20 +0800 Subject: [PATCH] chore(ci): build avatar-bot on push --- .github/workflows/build.yml | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7f78cf6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: build avatar-bot + +on: [push] + +env: + BUILDER_IMAGE: ghcr.io/nanpuyue/avatar-bot-builder + +jobs: + build: + name: build for ${{ matrix.arch }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - arch: amd64 + - arch: arm64 + permissions: + packages: write + contents: read + steps: + - name: Check out the repo + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Build avatar-bot + run: | + docker run --platform=linux/${{ matrix.arch }}\ + -e RUSTFLAGS="-C opt-level=s -C link-arg=-s"\ + -v "$PWD":"/build/avatar-bot"\ + --workdir "/build/avatar-bot"\ + ghcr.io/nanpuyue/avatar-bot-builder:latest\ + cargo build --release + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: avatar-bot.${{ matrix.arch }} + path: ./target/release/avatar-bot + if-no-files-found: error + retention-days: 30