iStoreNAS/.github/workflows/ci.yml

96 lines
2.8 KiB
YAML
Raw Normal View History

2023-11-08 17:12:15 +08:00
name: iStore Intl Builder
on:
workflow_dispatch:
2023-11-08 20:18:40 +08:00
inputs:
target:
description: 'build target ["x86_64", "rk35xx", "rk33xx", "rpi4", "all"]'
required: true
default: 'all'
2023-11-08 17:12:15 +08:00
env:
TZ: Asia/Shanghai
jobs:
2023-11-08 20:18:40 +08:00
matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Detect build target
id: set-matrix
env:
MATRIX_TARGET: ${{ github.event.inputs.target }}
run: |
if [ "x${MATRIX_TARGET}" = "x" -o "x${MATRIX_TARGET}" = "xall" ]; then \
echo "matrix={\"target\":[\"x86_64\", \"rk35xx\", \"rk33xx\", \"rpi4\"]}" >> $GITHUB_OUTPUT; \
else \
targets=""; \
for target in ${MATRIX_TARGET}; do \
targets="$targets, \"$target\"";
done; \
echo "matrix={\"target\":[${targets#, }]}" >> $GITHUB_OUTPUT; \
fi
2023-11-08 17:12:15 +08:00
build:
2023-11-08 20:18:40 +08:00
needs: matrix
2023-11-08 17:12:15 +08:00
runs-on: ubuntu-latest
2023-11-08 20:18:40 +08:00
name: iStore Intl for ${{ matrix.target }}
strategy:
matrix: ${{fromJson(needs.matrix.outputs.matrix)}}
2023-11-08 17:12:15 +08:00
steps:
- name: Checkout
uses: actions/checkout@main
with:
fetch-depth: 1
2023-11-08 20:18:40 +08:00
- name: Import Env
env:
MATRIX_TARGET: ${{ matrix.target }}
run: cat env/${MATRIX_TARGET}.env >> "$GITHUB_ENV"
2023-11-08 17:12:15 +08:00
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E apt-get -qq update
sudo -E apt-get -qq install binutils bzip2 xz-utils unzip git wget patch device-tree-compiler
sudo -E apt-get -qq clean
sudo timedatectl set-timezone "$TZ"
- name: Download IB
run: |
2023-11-08 17:14:36 +08:00
mkdir dl
2023-11-08 17:12:15 +08:00
wget -O dl/${IB_NAME}.tar.xz ${IB_URL}${IB_NAME}.tar.xz
wget -O dl/${MF_NAME} ${IB_URL}${MF_NAME}
wget -O dl/sha256sums ${IB_URL}sha256sums
2023-11-08 17:23:12 +08:00
[ -s dl/sha256sums ]
[ -s dl/${MF_NAME} ]
[ -s dl/${IB_NAME}.tar.xz ]
grep -Fq ${MF_NAME} dl/sha256sums
grep -Fq ${IB_NAME}.tar.xz dl/sha256sums
2023-11-08 17:17:43 +08:00
cd dl && sha256sum -c --ignore-missing --status sha256sums
2023-11-08 17:12:15 +08:00
- name: Unpack IB
run: |
mkdir ib
2023-11-08 17:23:12 +08:00
tar -C ib --strip-components=1 -xJf dl/${IB_NAME}.tar.xz
2023-11-08 17:12:15 +08:00
cp -a src/* ib/
ls patches/ | sort | xargs -n1 sh -c 'patch -p1 -d ib -i ../patches/$0'
sed -i 's/ unofficial/ oversea/' ib/Makefile
- name: Build
run: |
cp dl/${MF_NAME} ib/target.manifest
2023-11-08 20:18:40 +08:00
echo "istoreos-intl - *" >> ib/target.manifest
2023-11-08 17:12:15 +08:00
cd ib && make -f multi.mk image_multi
2023-11-08 20:18:40 +08:00
- name: Pack
run: |
cd ib
make -f release.mk IB=1
make -f multi.mk release_env >> "$GITHUB_ENV"
- name: Release
run: |
cd ib
diff ../dl/${MF_NAME} ${IB_BIN_DIR}/${MF_NAME}