GENIMAGE/ACTIONS: automate CFW release tag & status ver. (#94)

* [GENIMAGE]  automate CFW release tag & status ver.
- shell formatting
- add CFW_ITERATION count for Dev-build
- separate CFW and BR2 tagging
- don't use $BR2_VERSION_FULL

* [ACTIONS] build.yml:
- allow for manual workflow dispatch
- fetch-depth=0 (can't fetch-tags)
- rm commented line
- cleanup
- append `ref_name` for unofficials
This commit is contained in:
Apaczer
2024-03-08 17:07:46 +01:00
committed by GitHub
parent dc3f7dea54
commit fc489c0680
3 changed files with 82 additions and 31 deletions

View File

@@ -2,6 +2,7 @@ name: Buildroot
on:
push:
pull_request:
workflow_dispatch:
workflow_call:
inputs:
submodule:
@@ -26,8 +27,10 @@ jobs:
remove-docker-images: true
- uses: actions/checkout@v3
with:
fetch-depth: 0
- if: inputs.submodule
run: git submodule update --init --depth 1 -- ${{ inputs.submodule }}
run: git submodule update --init -- ${{ inputs.submodule }}
- name: retrieve ccache
uses: actions/cache@v3
@@ -37,22 +40,27 @@ jobs:
restore-keys: |
${{ inputs.submodule }}-uclibc-ccache-
- name: generate cfw hash
- name: generate cfw hash & iteration count
run: |
git config --global --add safe.directory /__w/buildroot/buildroot
echo "cfwsha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "cfw_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
if test $(git tag | wc -l) -ne 0; then \
echo "cfw_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT; \
echo "cfw_iteration=$(git rev-list --count $(git describe --tags --abbrev=0)..HEAD)" >> $GITHUB_OUTPUT; \
fi
id: cfwsha
- name: build
run: |
cd ${{ inputs.submodule || '.' }}
#apt update && apt install -y wget unzip build-essential git bc swig libncurses-dev libpython3-dev libssl-dev cpio rsync subversion
sudo apt update && sudo apt install -y gsfonts
make miyoo_uclibc_defconfig
CPU_N=$(getconf _NPROCESSORS_ONLN)
set -o pipefail
if ! ( \
make -j $CPU_N sdk CFW_HASH="${{ steps.cfwsha.outputs.cfwsha }}" APPEND_VERSION="-Dev_build" 2>&1 \
make -j $CPU_N sdk \
CFW_HASH="${{ steps.cfwsha.outputs.cfw_sha }}" CFW_TAG="${{ steps.cfwsha.outputs.cfw_tag }}" CFW_ITERATION="${{ steps.cfwsha.outputs.cfw_iteration }}" \
APPEND_VERSION="-Dev_build$(echo ${{ github.ref_name != 'master' && github.ref_name || '' }} | sed 's/\//-/g' | sed '/./ s/^/-/')" 2>&1 \
| tee build.log \
| grep ">>>" \
); then tail -n100 build.log && exit 1
@@ -74,7 +82,7 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: build image (uClibc)
path: ${{ inputs.submodule || '.' }}/output/images/miyoo-cfw-*.img
path: ${{ inputs.submodule || '.' }}/output/images/miyoo-*.img
if-no-files-found: error # 'error', 'warn', 'ignore'; defaults to `warn`
- uses: actions/upload-artifact@v3
@@ -111,8 +119,10 @@ jobs:
remove-docker-images: true
- uses: actions/checkout@v3
with:
fetch-depth: 0
- if: inputs.submodule
run: git submodule update --init --depth 1 -- ${{ inputs.submodule }}
run: git submodule update --init -- ${{ inputs.submodule }}
- name: retrieve ccache
uses: actions/cache@v3
@@ -122,22 +132,27 @@ jobs:
restore-keys: |
${{ inputs.submodule }}-musl-ccache-
- name: generate cfw hash
- name: generate cfw hash & iteration count
run: |
git config --global --add safe.directory /__w/buildroot/buildroot
echo "cfwsha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "cfw_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
if test $(git tag | wc -l) -ne 0; then \
echo "cfw_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT; \
echo "cfw_iteration=$(git rev-list --count $(git describe --tags --abbrev=0)..HEAD)" >> $GITHUB_OUTPUT; \
fi
id: cfwsha
- name: build
run: |
cd ${{ inputs.submodule || '.' }}
#apt update && apt install -y wget unzip build-essential git bc swig libncurses-dev libpython3-dev libssl-dev cpio rsync subversion
sudo apt update && sudo apt install -y gsfonts
make miyoo_musl_defconfig
CPU_N=$(getconf _NPROCESSORS_ONLN)
set -o pipefail
if ! ( \
make -j $CPU_N sdk CFW_HASH="${{ steps.cfwsha.outputs.cfwsha }}" APPEND_VERSION="-Dev_build" 2>&1 \
make -j $CPU_N sdk \
CFW_HASH="${{ steps.cfwsha.outputs.cfw_sha }}" CFW_TAG="${{ steps.cfwsha.outputs.cfw_tag }}" CFW_ITERATION="${{ steps.cfwsha.outputs.cfw_iteration }}" \
APPEND_VERSION="-Dev_build$(echo ${{ github.ref_name != 'master' && github.ref_name || '' }} | sed 's/\//-/g' | sed '/./ s/^/-/')" 2>&1 \
| tee build.log \
| grep ">>>" \
); then tail -n100 build.log && exit 1
@@ -159,7 +174,7 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: build image (musl)
path: ${{ inputs.submodule || '.' }}/output/images/miyoo-cfw-*.img
path: ${{ inputs.submodule || '.' }}/output/images/miyoo-*.img
if-no-files-found: error # 'error', 'warn', 'ignore'; defaults to `warn`
- uses: actions/upload-artifact@v3