Build VDRSternELEC #58
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 VDRSternELEC | |
on: | |
workflow_call: | |
inputs: | |
target: | |
description: "build" | |
type: string | |
required: true | |
defaulttarget: | |
description: "Default targets (used by target: all)" | |
type: string | |
required: true | |
addons: | |
description: "addons. Use '-' if no addon shall be build" | |
type: string | |
required: true | |
extras: | |
description: "extras. Use '-' if no parameter extra be used" | |
type: string | |
required: true | |
extraparameter: | |
description: "extra parameter. Use '-' if no parameter shall be used" | |
type: string | |
required: true | |
workflow_dispatch: | |
inputs: | |
target: | |
description: "build" | |
default: CoreELEC-22-no | |
required: true | |
type: choice | |
options: | |
- all default | |
- CoreELEC (all default) | |
- LibreELEC (all default) | |
- CoreELEC-20-ng | |
- CoreELEC-20-ne | |
- CoreELEC-21-ng | |
- CoreELEC-21-ne | |
- CoreELEC-22-no | |
- LibreELEC-12-aarch64-AMLGX | |
- LibreELEC-12-aarch64-Allwinner-H6 | |
- LibreELEC-12-aarch64-Allwinner-A64 | |
- LibreELEC-12-arm-Allwinner-R40 | |
- LibreELEC-12-arm-Allwinner-H3 | |
- LibreELEC-12-aarch64-Allwinner-H5 | |
- LibreELEC-12-aarch64-Rockchip-RK3399 | |
- LibreELEC-12-arm-Rockchip-RK3288 | |
- LibreELEC-12-aarch64-Rockchip-RK3328 | |
- LibreELEC-12-aarch64-RPi-RPi4 | |
- LibreELEC-12-aarch64-RPi-RPi5 | |
- LibreELEC-12-x86_64-x11 | |
- LibreELEC-13-aarch64-AMLGX | |
- LibreELEC-13-aarch64-Allwinner-H6 | |
- LibreELEC-13-aarch64-Allwinner-A64 | |
- LibreELEC-13-arm-Allwinner-R40 | |
- LibreELEC-13-arm-Allwinner-H3 | |
- LibreELEC-13-aarch64-Allwinner-H5 | |
- LibreELEC-13-aarch64-Rockchip-RK3399 | |
- LibreELEC-13-arm-Rockchip-RK3288 | |
- LibreELEC-13-aarch64-Rockchip-RK3328 | |
- LibreELEC-13-aarch64-RPi-RPi4 | |
- LibreELEC-13-aarch64-RPi-RPi5 | |
- LibreELEC-13-x86_64-x11 | |
defaulttarget: | |
description: "Default targets (used by target: all)" | |
default: "CoreELEC-20-ng CoreELEC-20-ne CoreELEC-21-ng CoreELEC-21-ne CoreELEC-22-no LibreELEC-12-aarch64-AMLGX LibreELEC-12-aarch64-Allwinner-H6 LibreELEC-12-aarch64-Rockchip-RK3399 LibreELEC-12-aarch64-RPi-RPi4 LibreELEC-12-aarch64-RPi-RPi5 LibreELEC-13-aarch64-AMLGX LibreELEC-13-aarch64-Allwinner-H6 LibreELEC-13-aarch64-Rockchip-RK3399 LibreELEC-13-aarch64-RPi-RPi4 LibreELEC-13-aarch64-RPi-RPi5" | |
type: string | |
addons: | |
description: "addons. Use '-' if no addon shall be build" | |
default: dvb-latest | |
type: string | |
extras: | |
description: "extras. Use '-' if no parameter extra be used" | |
default: easyvdr,channellogos,remotetranscode,cefbrowser | |
type: string | |
extraparameter: | |
description: "extra parameter. Use '-' if no parameter shall be used" | |
default: '-releaseonly' | |
type: string | |
jobs: | |
prepare: | |
runs-on: ubuntu-20.04 | |
outputs: | |
CURRENT_RELEASE_TAG: ${{ steps.create_release_tag.outputs.CURRENT_RELEASE_TAG }} | |
permissions: | |
actions: write | |
contents: read | |
steps: | |
- name: Prepare | |
run: | | |
gh extension install actions/gh-actions-cache | |
REPO=${{ github.repository }} | |
BRANCH="main" | |
echo "Fetching list of cache key" | |
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) | |
## Setting this to not fail the workflow while deleting cache keys. | |
set +e | |
for cacheKey in $cacheKeysForPR | |
do | |
echo "Delete cache entry $cacheKey in repo $REPO and branch $BRANCH" | |
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm | |
done | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: oprypin/find-latest-tag@v1 | |
with: | |
repository: ${{ github.repository }} | |
releases-only: false | |
id: current_release_tag | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
- name: create release tag file | |
id: create_release_tag | |
run: | | |
CURRENT_TAG=${{ steps.current_release_tag.outputs.tag }} | |
if [[ ! ${CURRENT_TAG} =~ ^${{ steps.date.outputs.date }} ]]; then | |
TAG="${{ steps.date.outputs.date }}.1" | |
else | |
if [[ "${CURRENT_TAG}" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}\.[0-9]+$ ]]; then | |
TAG=$(echo "${CURRENT_TAG}" | perl -pe 's/(\d+)(?!.*\d+)/$1+1/e') | |
else | |
TAG="${{ steps.date.outputs.date }}.1" | |
fi | |
fi | |
echo "CURRENT_RELEASE_TAG=${TAG}" >> "$GITHUB_OUTPUT" | |
echo "CURRENT_RELASE_TAG = ${TAG}" | |
prepare-matrix: | |
runs-on: ubuntu-20.04 | |
outputs: | |
matrix: ${{ steps.setmatrix.outputs.matrix }} | |
steps: | |
- name: Set Dynamic Matrix | |
id: setmatrix | |
run: | | |
ALL_DEFAULT="${{ inputs.defaulttarget }}" | |
JSON="{\"include\":[" | |
if [ "${{ inputs.target }}" = "all default" ] || [ "${{ inputs.target }}" = "" ]; then | |
BUILD=$ALL_DEFAULT | |
elif [ "${{ inputs.target }}" = "CoreELEC (all default)" ]; then | |
for i in $ALL_DEFAULT; do | |
if [[ "$i" == CoreELEC* ]]; then | |
BUILD="$BUILD $i" | |
fi | |
done | |
elif [ "${{ inputs.target }}" = "LibreELEC (all default)" ]; then | |
for i in $ALL_DEFAULT; do | |
if [[ "$i" == LibreELEC* ]]; then | |
BUILD="$BUILD $i" | |
fi | |
done | |
else | |
BUILD="${{ inputs.target }}" | |
fi | |
for i in $BUILD; do | |
JSON="${JSON} {\"run\":\"$i\"}," | |
done | |
JSON="${JSON} ]}" | |
echo "matrix=${JSON}" >> "$GITHUB_OUTPUT" | |
build-all: | |
needs: [ prepare, prepare-matrix ] | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }} | |
uses: ./.github/workflows/build-vdrsternelec.yml | |
with: | |
config: ${{ matrix.run }} | |
releasetag: ${{ needs.prepare.outputs.CURRENT_RELEASE_TAG }} | |
addons: ${{ inputs.addons }} | |
extras: ${{ inputs.extras }} | |
extraparameter: ${{ inputs.extraparameter }} | |
secrets: inherit | |
create-release: | |
needs: [ prepare, prepare-matrix, build-all ] | |
runs-on: ubuntu-20.04 | |
if: ${{ always() }} | |
steps: | |
- name: Maximize build space | |
uses: Zabrimus/maximize-build-space@master | |
- name: Download summary | |
uses: actions/download-artifact@v4 | |
with: | |
path: build-summary | |
pattern: build-summary-* | |
merge-multiple: true | |
- name: Download release artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: build-artifacts | |
pattern: build-artifacts-* | |
merge-multiple: true | |
- name: Download addon artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: build-addon | |
pattern: build-addon-* | |
merge-multiple: true | |
- name: Download cef artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: build-cef | |
pattern: build-cef-* | |
merge-multiple: true | |
- name: Create release and upload files | |
run: | | |
echo "-------------------------------" | |
echo "List build summaries...." | |
echo "-------------------------------" | |
if [ -d build-summary ]; then | |
ls -R build-summary | |
else | |
echo "Directory build-summary does not exists" | |
fi | |
echo "-------------------------------" | |
echo "List build artifacts...." | |
echo "-------------------------------" | |
if [ -d build-artifacts ]; then | |
ls -R build-artifacts | |
else | |
echo "Directory build-artifacts does not exists" | |
fi | |
echo "-------------------------------" | |
echo "List cef...." | |
echo "-------------------------------" | |
if [ -d build-cef ]; then | |
ls -R build-cef | |
else | |
echo "Directory build-cef does not exists" | |
fi | |
echo "-------------------------------" | |
echo "List addons...." | |
echo "-------------------------------" | |
if [ -d build-addon ]; then | |
ls -R build-addon | |
else | |
echo "Directory build-addon does not exists" | |
fi | |
echo "-------------------------------" | |
echo "Create Release notes..." | |
echo "-------------------------------" | |
VREV=$(git ls-remote https://github.com/${{ github.repository }} | head -1 | sed "s/HEAD//" | cut -c 1-7) | |
echo "VDRSternELEC: [master@${VREV}](https://github.com/${{ github.repository }}/tree/${VREV})" >> release_notes | |
echo "" >> release_notes | |
echo "----------------------------------------------------------------------------" >> release_notes | |
echo "| Status | Distro | Project | Device | Revision |" >> release_notes | |
echo "| ------- | ------ | ------- | ------ | -------- |" >> release_notes | |
cat build-summary/build-summary* >> release_notes | |
cat release_notes | |
echo "-------------------------------" | |
echo "Create Release..." | |
echo "-------------------------------" | |
# create release | |
gh release create "${{ needs.prepare.outputs.CURRENT_RELEASE_TAG }}" -R ${{ github.repository }} -F release_notes --draft | |
echo "-------------------------------" | |
echo "Upload cef..." | |
echo "-------------------------------" | |
# upload cef files | |
for i in $(ls build-cef/*.zip); do | |
echo "Upload $i in release tag ${{ needs.prepare.outputs.CURRENT_RELEASE_TAG }}" | |
gh release upload "${{ needs.prepare.outputs.CURRENT_RELEASE_TAG }}" $i --clobber -R ${{ github.repository }} | |
done | |
echo "-------------------------------" | |
echo "Upload addons..." | |
echo "-------------------------------" | |
# upload addon files | |
for i in $(ls build-addon/CoreELEC/target/addons/CoreELEC*zip); do | |
echo "Upload $i in release tag ${{ needs.prepare.outputs.CURRENT_RELEASE_TAG }}" | |
gh release upload "${{ needs.prepare.outputs.CURRENT_RELEASE_TAG }}" $i --clobber -R ${{ github.repository }} | |
done | |
for i in $(ls build-addon/LibreELEC.tv/target/addons/LibreELEC*zip); do | |
echo "Upload $i in release tag ${{ needs.prepare.outputs.CURRENT_RELEASE_TAG }}" | |
gh release upload "${{ needs.prepare.outputs.CURRENT_RELEASE_TAG }}" $i --clobber -R ${{ github.repository }} | |
done | |
echo "-------------------------------" | |
echo "Upload release..." | |
echo "-------------------------------" | |
# upload release files | |
for i in $(ls build-artifacts/CoreELEC/target/VDR*); do | |
echo "Upload $i in release tag ${{ needs.prepare.outputs.CURRENT_RELEASE_TAG }}" | |
gh release upload "${{ needs.prepare.outputs.CURRENT_RELEASE_TAG }}" $i --clobber -R ${{ github.repository }} | |
done | |
for i in $(ls build-artifacts/LibreELEC.tv/target/VDR*); do | |
echo "Upload $i in release tag ${{ needs.prepare.outputs.CURRENT_RELEASE_TAG }}" | |
gh release upload "${{ needs.prepare.outputs.CURRENT_RELEASE_TAG }}" $i --clobber -R ${{ github.repository }} | |
done | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# delete-old-releases: | |
# needs: [create-release] | |
# name: delete-old-releases | |
# runs-on: ubuntu-20.04 | |
# if: ${{ always() }} | |
# steps: | |
# - uses: dev-drprasad/[email protected] | |
# with: | |
# repo: ${{ github.repository }} | |
# keep_latest: 8 |