Merge pull request #387 from CodeChenL/main #635
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Release | |
on: | |
workflow_dispatch: | |
merge_group: | |
pull_request: | |
push: | |
permissions: {} | |
jobs: | |
build-dtbo: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
version: [linux-rockchip, linux-rk356x, linux-stable, linux-rk2312, linux-rk2410] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check if there is missing files | |
shell: bash | |
run: | | |
MISSING=0 | |
for VENDOR in amlogic rockchip | |
do | |
OVERLAY_PATH="arch/arm64/boot/dts/$VENDOR/overlays" | |
for i in "$OVERLAY_PATH"/*.dts | |
do | |
OVERLAY_NAME="$(basename "$i")" | |
OVERLAY_NAME="${OVERLAY_NAME/.dts}.dtbo" | |
if ! grep "$OVERLAY_NAME" "${OVERLAY_PATH}/Makefile"* >/dev/null 2>/dev/null | |
then | |
echo "$OVERLAY_NAME is not included in $VENDOR Makefile!" | |
MISSING=1 | |
fi | |
done | |
done | |
exit $MISSING | |
- name: Install dependencies | |
shell: bash | |
run: | | |
sudo apt update | |
sudo apt install -y --no-install-recommends device-tree-compiler | |
sudo dpkg --add-architecture arm64 | |
case "${{ matrix.version }}" in | |
linux-rockchip) | |
wget https://github.com/radxa-pkg/linux-rockchip/releases/download/5.10.110-38/linux-headers-5.10.110-38-rockchip_5.10.110-38-7a04ba0ad_arm64.deb | |
sudo apt install ./linux-headers-*.deb | |
;; | |
linux-rk356x) | |
wget https://github.com/radxa-pkg/linux-rk356x/releases/download/5.10.160-37/linux-headers-5.10.160-37-rk356x_5.10.160-37-ff919543b_arm64.deb | |
sudo apt install ./linux-headers-*.deb | |
;; | |
linux-rk2312) | |
wget https://github.com/radxa-pkg/linux-rk2312/releases/download/6.1.43-15/linux-headers-6.1.43-15-rk2312_6.1.43-15-3176a44da_arm64.deb | |
sudo apt install ./linux-headers-*.deb | |
;; | |
linux-rk2410) | |
wget https://github.com/radxa-pkg/linux-rk2410/releases/download/6.1.84-1/linux-headers-6.1.84-1-rk2410_6.1.84-1-3bf163742_arm64.deb | |
sudo apt install ./linux-headers-*.deb | |
;; | |
esac | |
- name: Build | |
shell: bash | |
run: | | |
case "${{ matrix.version }}" in | |
linux-stable) | |
make build-dtbo -j$(nproc) | |
;; | |
linux-rockchip) | |
make build-dtbo -j$(nproc) KERNELRELEASE=5.10.110-38-rockchip CONFIG_ARCH_MESON=n CONFIG_CPU_RK3399=rockchip CONFIG_CPU_RK3588=rockchip | |
;; | |
linux-rk356x) | |
make build-dtbo -j$(nproc) KERNELRELEASE=5.10.160-37-rk356x CONFIG_ARCH_MESON=n CONFIG_CPU_RK3528=rockchip CONFIG_CPU_RK3568=rockchip | |
;; | |
linux-rk2312) | |
make build-dtbo -j$(nproc) KERNELRELEASE=6.1.43-15-rk2312 CONFIG_ARCH_MESON=n CONFIG_CPU_RK3588=rockchip | |
;; | |
linux-rk2410) | |
make build-dtbo -j$(nproc) KERNELRELEASE=6.1.84-1-rk2410 CONFIG_ARCH_MESON=n CONFIG_CPU_RK3588=rockchip CONFIG_CPU_RK3576=rockchip | |
;; | |
esac | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.version }} | |
path: | | |
arch/**/*.dtbo | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
distro: ${{ steps.distro_check.outputs.distro }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Test | |
run: | | |
make test | |
- name: Build | |
run: | | |
sudo apt-get update | |
sudo apt-get build-dep --no-install-recommends -y . | |
make all deb | |
- name: Workaround actions/upload-artifact#176 | |
run: | | |
echo "artifacts_path=$(realpath ..)" >> $GITHUB_ENV | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }} | |
path: | | |
${{ env.artifacts_path }}/*.deb | |
- name: Check if the latest version is releasable | |
id: distro_check | |
run: | | |
version="$(dpkg-parsechangelog -S Version)" | |
if [[ -n "$(git tag -l "$version")" ]] | |
then | |
echo "distro=UNRELEASED" >> "$GITHUB_OUTPUT" | |
else | |
echo "distro=$(dpkg-parsechangelog -S Distribution)" >> "$GITHUB_OUTPUT" | |
fi | |
release: | |
runs-on: ubuntu-latest | |
needs: [build-dtbo, build] | |
if: github.event_name != 'pull_request' && github.event_name != 'merge_group' && github.ref_name == 'main' && needs.build.outputs.distro != 'UNRELEASED' | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }} | |
path: .artifacts | |
- name: Prepare for release | |
run: | | |
version="$(dpkg-parsechangelog -S Version)" | |
echo "version=$version" >> $GITHUB_ENV | |
echo "changes<<EOF" >> $GITHUB_ENV | |
echo '```' >> $GITHUB_ENV | |
echo "$(dpkg-parsechangelog -S Changes)" >> $GITHUB_ENV | |
echo '```' >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
echo "$version" > VERSION | |
if [[ -f pkg.conf.template ]] | |
then | |
sed "s/VERSION/$(dpkg-parsechangelog -S Version)/g" pkg.conf.template > pkg.conf | |
fi | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.version }} | |
body_path: README.md | |
token: ${{ secrets.GITHUB_TOKEN }} | |
target_commitish: ${{ github.ref_name }} | |
draft: false | |
fail_on_unmatched_files: false | |
files: | | |
.artifacts/**/*.deb | |
pkg.conf | |
VERSION | |
- name: Append changelog | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.version }} | |
body: | | |
## Changelog for ${{ env.version }} | |
${{ env.changes }} | |
append_body: true | |
- name: Update Test repos | |
uses: radxa-repo/update-repo-action@main | |
with: | |
test-repo: true | |
token: ${{ secrets.RADXA_APT_TEST_REPO_TOKEN }} |