From 038a3fd36ccbca689ea284564b5f7a126358cbfe Mon Sep 17 00:00:00 2001 From: Mufanc Date: Sun, 10 Dec 2023 14:19:06 +0800 Subject: [PATCH] chore: fix CI --- .github/workflows/ci.yml | 20 +++++++++++++++----- .github/workflows/scripts/ci.sh | 13 +++++++++++++ build.sh | 7 ++++++- inject/rust-toolchain.toml | 2 ++ 4 files changed, 36 insertions(+), 6 deletions(-) create mode 100755 .github/workflows/scripts/ci.sh create mode 100644 inject/rust-toolchain.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ced9f1e..8e76bd4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: Build CI on: push: - branches: [ master ] + branches: [ archlinux ] paths-ignore: - '**.md' workflow_dispatch: @@ -19,12 +19,22 @@ jobs: with: fetch-depth: 0 - - name: Repack Linux-QQ - run: make + - name: Setup ArchLinux + uses: docker://archlinux:latest + with: + entrypoint: /bin/bash + args: .github/workflows/scripts/ci.sh + + - name: Prepare Artifact + id: prepare_artifact + run: | + echo "name=$(echo qwrapper*.pkg | sed 's/.pkg.*//')" >> $GITHUB_OUTPUT - name: Upload Artifact if: success() uses: actions/upload-artifact@v3 with: - name: LinuxQQ-patched.deb - path: LinuxQQ-patched.deb + name: ${{ steps.prepare_artifact.outputs.name }} + path: | + PKGBUILD + qwrapper*.pkg.* diff --git a/.github/workflows/scripts/ci.sh b/.github/workflows/scripts/ci.sh new file mode 100755 index 0000000..f742845 --- /dev/null +++ b/.github/workflows/scripts/ci.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +set -ex + +pacman -Syu --noconfirm --needed base-devel rustup pacman-contrib + +rustup toolchain install stable +rustup toolchain install nightly + +chmod -R a+rw . +useradd builder -m && echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + +sudo -u builder BUILDARGS="--syncdeps --noconfirm" make diff --git a/build.sh b/build.sh index ce5a936..cb825ab 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,11 @@ +set -ex + export SOURCE=$(curl -s https://im.qq.com/rainbow/linuxQQDownload/ | grep -Eo '"deb":"[^"]+"' | grep -Eo 'https://.*_amd64\.deb') export PKGVER=$(echo "$SOURCE" | awk -F "linuxqq_|-" '{print $2}') export PKGROOT=$(realpath "$(dirname "$0")") + envsubst "$(env | grep -Po '^[A-Z_]+(?==)' | sed 's/^/$/g')" < PKGBUILD.proto > PKGBUILD updpkgsums -makepkg -f + +# shellcheck disable=SC2086 +makepkg -f $BUILDARGS diff --git a/inject/rust-toolchain.toml b/inject/rust-toolchain.toml new file mode 100644 index 0000000..292fe49 --- /dev/null +++ b/inject/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "stable"