matrix and release
This commit is contained in:
parent
71213d3150
commit
16b5e3bd23
51
.github/workflows/ci.yml
vendored
51
.github/workflows/ci.yml
vendored
@ -2,23 +2,51 @@ name: iStore Intl Builder
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
inputs:
|
||||
target:
|
||||
description: 'build target ["x86_64", "rk35xx", "rk33xx", "rpi4", "all"]'
|
||||
required: true
|
||||
default: 'all'
|
||||
env:
|
||||
IB_NAME: openwrt-imagebuilder-22.03.5-x86-64.Linux-x86_64
|
||||
MF_NAME: openwrt-22.03.5-x86-64.manifest
|
||||
IB_URL: https://downloads.openwrt.org/releases/22.03.5/targets/x86/64/
|
||||
TZ: Asia/Shanghai
|
||||
|
||||
jobs:
|
||||
build:
|
||||
matrix:
|
||||
runs-on: ubuntu-latest
|
||||
name: iStore Intl Builder
|
||||
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
|
||||
build:
|
||||
needs: matrix
|
||||
runs-on: ubuntu-latest
|
||||
name: iStore Intl for ${{ matrix.target }}
|
||||
strategy:
|
||||
matrix: ${{fromJson(needs.matrix.outputs.matrix)}}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@main
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Import Env
|
||||
env:
|
||||
MATRIX_TARGET: ${{ matrix.target }}
|
||||
run: cat env/${MATRIX_TARGET}.env >> "$GITHUB_ENV"
|
||||
|
||||
- name: Initialization environment
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
@ -52,5 +80,16 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
cp dl/${MF_NAME} ib/target.manifest
|
||||
echo "istoreos-intl - *" >> ib/target.manifest
|
||||
cd ib && make -f multi.mk image_multi
|
||||
|
||||
- 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}
|
||||
|
3
env/x86_64.env
vendored
Normal file
3
env/x86_64.env
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
IB_NAME=openwrt-imagebuilder-22.03.5-x86-64.Linux-x86_64
|
||||
MF_NAME=openwrt-22.03.5-x86-64.manifest
|
||||
IB_URL=https://downloads.openwrt.org/releases/22.03.5/targets/x86/64/
|
@ -35,4 +35,8 @@ image_multi:
|
||||
$(MAKE) -f multi.mk -s _call_image_multi )
|
||||
|
||||
profiles_multi:
|
||||
$(STAGING_DIR_HOST)/bin/sed -n 's/^CONFIG_TARGET_$(if $(CONFIG_TARGET_MULTI_PROFILE),DEVICE_)$(call target_conf,$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)))_\(.*\)=y/\1/p' .config
|
||||
@$(STAGING_DIR_HOST)/bin/sed -n 's/^CONFIG_TARGET_$(if $(CONFIG_TARGET_MULTI_PROFILE),DEVICE_)$(call target_conf,$(BOARD)$(if $(SUBTARGET),_$(SUBTARGET)))_\(.*\)=y/\1/p' .config
|
||||
|
||||
release_env:
|
||||
@echo "IB_BIN_DIR=$(BIN_DIR)"
|
||||
@echo "IB_OS_RELEASE=$(VERSION_DIST_SANITIZED)-$(VERSION_NUMBER)-$(VERSION_CODE)"
|
||||
|
166
src/release.mk
Normal file
166
src/release.mk
Normal file
@ -0,0 +1,166 @@
|
||||
|
||||
CUR_MAKEFILE:=$(filter-out Makefile,$(firstword $(MAKEFILE_LIST)))
|
||||
SUBMAKE:=make $(if $(CUR_MAKEFILE),-f $(CUR_MAKEFILE))
|
||||
|
||||
ifneq ($(BUILD),)
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
REVISION:=$(shell $(TOPDIR)/scripts/getver.sh)
|
||||
SOURCE_DATE_EPOCH:=$(shell $(TOPDIR)/scripts/get_source_date_epoch.sh)
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
|
||||
all: $(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED))
|
||||
|
||||
define IMAGE/TARGET
|
||||
|
||||
FIRMWARE_BASE_NAME:=$(patsubst %.img,%,$(patsubst %.gz,%,$(3)))
|
||||
|
||||
$(1)/$(2)/version.index: $(1)/$(2)/$$(FIRMWARE_BASE_NAME).yaml
|
||||
echo "$(VERSION_NUMBER)-$(VERSION_CODE)" > $$@
|
||||
|
||||
$(1)/$(2)/$$(FIRMWARE_BASE_NAME).yaml: $(1)/$(2)/version.latest
|
||||
echo "filename: $(3)" > $$@
|
||||
echo "path: /iStoreOS/$(2)/" >> $$@
|
||||
head -3 $(1)/$(2)/version.latest | tail -2 | tr 'A-Z' 'a-z' >> $$@
|
||||
echo "device: $(2)" >> $$@
|
||||
echo "version: $(VERSION_NUMBER)" >> $$@
|
||||
echo "release: $(VERSION_CODE)" >> $$@
|
||||
TZ='CST-8' date +'date: %F %T' -r '$(1)/$(2)/$(3)' >> $$@
|
||||
echo "type: istoreos" >> $$@
|
||||
|
||||
$(1)/$(2)/version.latest: $(1)/$(2)/$(3)
|
||||
echo "[$(3)]($(3))" > $$@; \
|
||||
FIRMWARE_SHA256=`sha256sum $(1)/$(2)/$(3) | cut -d' ' -f1`; \
|
||||
echo "SHA256: $$$${FIRMWARE_SHA256}" >> $$@ ; \
|
||||
FIRMWARE_MD5=`md5sum $(1)/$(2)/$(3)| cut -d' ' -f1`; \
|
||||
echo "MD5: $$$${FIRMWARE_MD5}" >> $$@
|
||||
|
||||
$(1)/$(2)/$(3): $(BIN_DIR)/$(if $(4),$(4),$(3))
|
||||
mkdir -p $(1)/$(2)
|
||||
$(CP) $(BIN_DIR)/feeds.buildinfo $(1)/$(2)/
|
||||
$(CP) $(BIN_DIR)/config.buildinfo $(1)/$(2)/
|
||||
git log -n 1 --format="%h" > $(1)/$(2)/commit.buildinfo
|
||||
$(CP) ./feeds.conf $(1)/$(2)/
|
||||
./scripts/diffconfig.sh > $(1)/$(2)/config.seed
|
||||
$(CP) $$< $$@
|
||||
|
||||
endef
|
||||
|
||||
define IMAGE/BUILDER
|
||||
|
||||
$(1)/$(2)/$(3).tar.xz: $(BIN_DIR)/$(3).tar.xz
|
||||
mkdir -p $(1)/$(2)
|
||||
$(CP) $$< $$@
|
||||
|
||||
$(1)/$(2)/$(4): $(BIN_DIR)/$(4)
|
||||
mkdir -p $(1)/$(2)
|
||||
$(CP) $$< $$@
|
||||
|
||||
$(1)/$(2)/sha256sums: $(1)/$(2)/$(3).tar.xz $(1)/$(2)/$(4)
|
||||
@$$(call sha256sums,$(1)/$(2))
|
||||
|
||||
endef
|
||||
|
||||
DIST_DIR:=../build
|
||||
|
||||
COMMON/IMAGE=$(call IMAGE/TARGET,$(DIST_DIR),$(2),$(VERSION_DIST_SANITIZED)-$(VERSION_NUMBER)-$(VERSION_CODE)-$(1)-$(2)-squashfs.img.gz,$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED))-squashfs-sysupgrade.img.gz)
|
||||
|
||||
COMMON/MULTI_DEVICES=$(call IMAGE/TARGET,$(DIST_DIR),$(if $(3),$(3),$(2)),$(VERSION_DIST_SANITIZED)-$(VERSION_NUMBER)-$(VERSION_CODE)-$(if $(3),$(3),$(2))-squashfs.img.gz,$(IMG_PREFIX)-$(1)_$(2)-squashfs-sysupgrade.img.gz)
|
||||
|
||||
COMMON/COMBINED_DEVICE=$(call IMAGE/TARGET,$(DIST_DIR),$(if $(3),$(3),$(2)),$(VERSION_DIST_SANITIZED)-$(VERSION_NUMBER)-$(VERSION_CODE)-$(if $(3),$(3),$(2))-squashfs-combined.img.gz,$(IMG_PREFIX)-$(1)_$(2)-squashfs-combined.img.gz)
|
||||
|
||||
HOST_OS:=$(shell uname)
|
||||
HOST_ARCH:=$(shell uname -m)
|
||||
IB_DIR:=$(DIST_DIR)/ib
|
||||
IB_NAME:=$(VERSION_DIST_SANITIZED)-imagebuilder-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)).$(HOST_OS)-$(HOST_ARCH)
|
||||
MF_NAME:=$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED)).manifest
|
||||
|
||||
COMMON/BUILDER=$(call IMAGE/BUILDER,$(IB_DIR),$(1),$(IB_NAME),$(MF_NAME))
|
||||
|
||||
ifeq ($(BOARD), x86)
|
||||
X86_64_DIR:=$(DIST_DIR)/x86_64
|
||||
X86_64_IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(VERSION_NUMBER)-$(VERSION_CODE)-x86-64-squashfs-combined
|
||||
X86_64_SRC_PREFIX:=$(IMG_PREFIX)$(if $(PROFILE_SANITIZED),-$(PROFILE_SANITIZED))-squashfs-combined
|
||||
|
||||
X86_64/IMAGE=$(call IMAGE/TARGET,$(DIST_DIR),x86_64$(if $(1),_$(1)),$(X86_64_IMG_PREFIX)$(if $(1),-$(1)).img.gz,$(X86_64_SRC_PREFIX)$(if $(1),-$(1)).img.gz)
|
||||
|
||||
$(eval $(call X86_64/IMAGE,))
|
||||
$(eval $(call X86_64/IMAGE,efi))
|
||||
$(eval $(call COMMON/BUILDER,x86_64))
|
||||
|
||||
x86-64-generic: $(X86_64_DIR)/version.index $(X86_64_DIR)_efi/version.index \
|
||||
$(if $(IB),,$(IB_DIR)/x86_64/sha256sums)
|
||||
endif
|
||||
|
||||
ifeq ($(BOARD), rockchip)
|
||||
ifeq ($(SUBTARGET), armv8)
|
||||
ifneq ($(PROFILE_SANITIZED),)
|
||||
$(eval $(call COMMON/IMAGE,nanopi,r2s))
|
||||
|
||||
rockchip-armv8-friendlyarm_nanopi-r2s: $(DIST_DIR)/r2s/version.index
|
||||
|
||||
$(eval $(call COMMON/IMAGE,nanopi,r4s))
|
||||
|
||||
rockchip-armv8-friendlyarm_nanopi-r4s: $(DIST_DIR)/r4s/version.index
|
||||
else # !PROFILE_SANITIZED
|
||||
|
||||
$(eval $(call COMMON/MULTI_DEVICES,friendlyarm,nanopi-r2s,r2s))
|
||||
$(eval $(call COMMON/MULTI_DEVICES,friendlyarm,nanopi-r4s,r4s))
|
||||
$(eval $(call COMMON/MULTI_DEVICES,friendlyarm,nanopi-r4se,r4se))
|
||||
|
||||
$(eval $(call COMMON/BUILDER,rk33xx))
|
||||
|
||||
rockchip-armv8: $(DIST_DIR)/r2s/version.index $(DIST_DIR)/r4s/version.index $(DIST_DIR)/r4se/version.index \
|
||||
$(if $(IB),,$(IB_DIR)/rk33xx/sha256sums)
|
||||
|
||||
endif # PROFILE_SANITIZED
|
||||
endif # armv8
|
||||
|
||||
ifeq ($(SUBTARGET), rk35xx)
|
||||
$(eval $(call COMMON/COMBINED_DEVICE,fastrhino,r6xs))
|
||||
$(eval $(call COMMON/COMBINED_DEVICE,friendlyarm,nanopi-r5s,r5s))
|
||||
$(eval $(call COMMON/COMBINED_DEVICE,friendlyarm,nanopi-r6s,r6s))
|
||||
$(eval $(call COMMON/MULTI_DEVICES,firefly,station-p2))
|
||||
$(eval $(call COMMON/MULTI_DEVICES,lyt,t68m))
|
||||
$(eval $(call COMMON/COMBINED_DEVICE,hinlink,opc-h6xk,h6xk))
|
||||
$(eval $(call COMMON/COMBINED_DEVICE,hinlink,h88k))
|
||||
$(eval $(call COMMON/MULTI_DEVICES,hlink,h28k))
|
||||
$(eval $(call COMMON/BUILDER,rk35xx))
|
||||
rockchip-rk35xx: $(DIST_DIR)/r6xs/version.index \
|
||||
$(DIST_DIR)/r5s/version.index $(DIST_DIR)/r6s/version.index \
|
||||
$(DIST_DIR)/station-p2/version.index \
|
||||
$(DIST_DIR)/h6xk/version.index \
|
||||
$(DIST_DIR)/h88k/version.index \
|
||||
$(DIST_DIR)/h28k/version.index \
|
||||
$(DIST_DIR)/t68m/version.index \
|
||||
$(if $(IB),,$(IB_DIR)/rk35xx/sha256sums)
|
||||
endif # rk35xx
|
||||
|
||||
endif # rockchip
|
||||
|
||||
ifeq ($(BOARD)-$(SUBTARGET), bcm27xx-bcm2711)
|
||||
$(eval $(call COMMON/IMAGE,raspberrypi,rpi4))
|
||||
$(eval $(call COMMON/BUILDER,bcm2711))
|
||||
bcm27xx-bcm2711-rpi-4: $(DIST_DIR)/rpi4/version.index \
|
||||
$(if $(IB),,$(IB_DIR)/bcm2711/sha256sums)
|
||||
endif # bcm27xx-bcm2711
|
||||
|
||||
else
|
||||
|
||||
TOPDIR:=${CURDIR}
|
||||
|
||||
LC_ALL:=C
|
||||
LANG:=C
|
||||
TZ:=UTC
|
||||
export TOPDIR LC_ALL LANG TZ
|
||||
|
||||
export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
|
||||
|
||||
all: FORCE
|
||||
$(SUBMAKE) BUILD=1 $(if $(IB),IB="$(IB)")
|
||||
%: FORCE
|
||||
$(SUBMAKE) BUILD=1 $@ $(if $(IB),IB="$(IB)")
|
||||
|
||||
FORCE: ;
|
||||
.PHONY: FORCE
|
||||
endif
|
Loading…
Reference in New Issue
Block a user