Update build-images.yml

Signed-off-by: Igor <igor@armbian.com>
This commit is contained in:
Igor Pečovnik
2023-02-21 10:11:35 +01:00
committed by Igor
parent de107cf86e
commit 8593d22650
4 changed files with 60 additions and 232 deletions

6
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

View File

@@ -1,123 +1,44 @@
name: Build Images
#
# Generates beta, stable or RC images. You can select build runners. By default it generates all images, but you can build images only for one target
# Images are placed at www.arnmbian.com and nighly beta also at https://github.com/armbian/build/releases/tag/latest
name: Build Nighly Images
#
on:
# schedule:
# - cron: "30 0 * * *"
schedule:
- cron: "30 0 * * *"
workflow_dispatch:
inputs:
choice:
type: choice
description: Build targets
options:
- beta
- stable
- rc
runner:
type: choice
description: Build runners for CLI
options:
- small
- ubuntu-latest
sourcerepo:
description: Source repository
required: false
default: 'nightly'
packagesrepo:
type: choice
description: Beta packages repository
options:
- "yes"
- "no"
fromsources:
type: choice
description: Build from sources
options:
- "no"
- "yes"
advanced:
description: 'Single board (grep -w tinkerboard |)'
required: false
default: ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
Cancel:
name: "Cancel currently active"
# In case we have a currently active build, cancel it
Prepare:
name: "Generate version"
if: ${{ github.repository_owner == 'Armbian' }}
runs-on: [ubuntu-latest]
timeout-minutes: 3
runs-on: ubuntu-latest
outputs:
version: ${{steps.releases.outputs.version}}
steps:
- uses: styfle/cancel-workflow-action@0.11.0
if: ${{ github.event.schedule == '' }}
- name: "Cancel active workflow"
uses: styfle/cancel-workflow-action@0.11.0
with:
all_but_latest: true
access_token: ${{ secrets.GITHUB_TOKEN }}
clean:
if: ${{ github.repository_owner == 'Armbian' }}
needs: Cancel
name: Purge older releases
runs-on: [ubuntu-latest]
steps:
- name: ver
run: |
echo "${{ github.event.release.tag_name }}"
- name: Purge old releases of trunk build
- name: "Purge old releases of trunk build"
uses: Vucko130/delete-older-releases@v0.2.2
with:
keep_latest: 2
delete_tag_pattern: trunk
keep_latest: 1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Purge action workflow logs
- name: "Purge action workflow logs"
uses: igorjs/gh-actions-clean-workflow@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
days_old: 14
fake:
if: ${{ github.repository_owner == 'Armbian' }}
runs-on: [ubuntu-latest]
needs: [ clean ]
name: Source changes
outputs:
changes: ${{steps.list_releases.outputs.changes}}
version: ${{steps.list_releases.outputs.version}}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
repository: armbian/build
path: build
clean: false
ref: main
days_old: 10
- name: "Get latest release version"
if: ${{ github.repository_owner == 'Armbian' && github.event.inputs.choice != 'stable' && github.event.inputs.choice != 'rc' }}
id: list_releases
id: releases
run: |
get_latest_release() {
@@ -127,60 +48,43 @@ jobs:
}
VER=$(echo $(get_latest_release "armbian/os") | rev | cut -d'.' -f 1 | rev | sed 's/^0*//')
PREFIX=$(echo $(cat build/VERSION | sed "s/-trunk.*//"))
PREFIX=$(echo $(curl https://raw.githubusercontent.com/armbian/build/main/VERSION | sed "s/-trunk.*//"))
RELE=$(printf "%04d\n" $((VER+1)))
echo "version=${PREFIX}.${RELE}" >> $GITHUB_OUTPUT
echo "version=${PREFIX}.${RELE}"
- uses: actions/upload-artifact@v3
with:
path: changes
name: changes
if-no-files-found: ignore
- uses: actions/upload-artifact@v3
with:
path: changes
name: changes
if-no-files-found: ignore
generaterelease:
needs: [ fake ]
if: ${{ github.repository_owner == 'Armbian' && needs.fake.outputs.changes != 'true' }}
needs: [ Prepare ]
if: ${{ github.repository_owner == 'Armbian' }}
runs-on: ubuntu-latest
name: "Update latest release"
name: "Generate release"
outputs:
version: ${{steps.releases.outputs.version}}
steps:
- run: |
- name: "Get latest release version"
id: releases
run: |
echo "version=${{ needs.Prepare.outputs.version }}" >> $GITHUB_OUTPUT
- run: |
echo "Env: ${{ github.event.inputs.choice }}"
echo "Env: ${{ github.event.inputs.runner }}"
echo "Env: ${{ github.event.inputs.sourcerepo }}"
echo "Branch: ${{ github.event.inputs.branch }}"
echo "Version: ${{ needs.fake.outputs.version }}"
echo "Version: ${{ needs.Prepare.outputs.version }}"
- uses: actions/checkout@v3
if: ${{ github.repository_owner == 'Armbian' && github.event.inputs.choice != 'stable' && github.event.inputs.choice != 'rc' }}
with:
fetch-depth: 1
- uses: ClementTsang/delete-tag-and-release@v0.3.1
if: ${{ github.repository_owner == 'Armbian' && github.event.inputs.choice != 'stable' && github.event.inputs.choice != 'rc' }}
with:
delete_release: true
tag_name: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ncipollo/release-action@v1
if: ${{ github.repository_owner == 'Armbian' && github.event.inputs.choice != 'stable' && github.event.inputs.choice != 'rc' }}
with:
artifacts: "LICENSE"
tag: "${{ needs.fake.outputs.version }}"
tag: "${{ needs.Prepare.outputs.version }}"
name: "Build in progress"
bodyFile: ".github/Releases-wip.md"
allowUpdates: true
@@ -199,7 +103,7 @@ jobs:
branch: ''
release: ''
variant: ''
version: "${{ needs.fake.outputs.version }}"
version: "${{ needs.generaterelease.outputs.version }}"
jobsend:

View File

@@ -1,96 +0,0 @@
name: image-simple
on:
push:
tags:
- "armbian*" # any tag. GH releases (containing binaries for download) require tags
workflow_dispatch:
jobs:
prepare:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'armbian' }}
outputs:
tagName: ${{ steps.tagName.outputs.tag }}
steps:
- uses: olegtarasov/get-tag@14deb5cb39a98e81adb64f8ac8b27aefab278784 # get the tag name from the ref. v2.1.2 https://github.com/olegtarasov/get-tag/releases/tag/v2.1.2
id: tagName
# This creates an empty release on the tag with just the header.
- name: Release ${{ matrix.board }}
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # de2c0eb8 = v0.1.5; already with koplo199's node16 fixes
if: startsWith(github.ref, 'refs/tags/') # only for tags. GitHub requires tags for releases.
with:
append_body: true # append, since we've descriptions in there already
body: |
### Release ${{ steps.tagName.outputs.tag }} images below, in no particular order
"Images": # short name because GH will expand with the matrix values
needs: [ prepare ]
timeout-minutes: 60
if: ${{ github.repository_owner == 'armbian' }}
strategy:
fail-fast: false # let other jobs try to complete if one fails
matrix:
# board: the BOARD= to build
# desc: markdown for description in release notes
# variant: env vars to pass both to scripts and ./compile.sh
# aa: GH Actions orders the jobs by the first key value. 'aa' should be first. it never is. it is actually quite pointless trying. it's effectively random.
include:
# 0000 = stuff I need first for emergency reasons, avoid.
# 0100 = meson64 stuff (fixed version), boards I own first, then others
# 0200 = uefi stuff (fixed version)
# 0500+ other stuff
# 0100 = meson64 stuff (fixed version), boards I own first, then others
- aa: 0111
board: bananapim5
desc: BananaPi M5, edge, regular CLI
runner_tags: qemu
variant: "CLOUD_IMAGE=no BRANCH=edge"
- aa: 0115
board: odroidn2
desc: ODROID N2+, edge, regular CLI
runner_tags: qemu
variant: "CLOUD_IMAGE=no BRANCH=edge"
runs-on: "${{ matrix.runner_tags }}"
name: "${{ matrix.aa }} ${{ matrix.desc }}"
env:
BOARD: "${{ matrix.board }}"
VARIANT: "${{ matrix.variant }}"
EXTRA: "'DONT_BUILD_ARTIFACTS=kernel,firmware,full_firmware,rootfs' COMPRESS_OUTPUTIMAGE=xz "
steps:
- name: Checkout build repo
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/build
ref: main
clean: false # true is default. it *will* delete the hosts /dev if mounted inside.
- name: Build board ${{ matrix.board }}
id: buildBoard
run: |
#mkdir -p userpatches
#echo "${{needs.prepare.outputs.tagName}}-${{ github.repository_owner }}" > userpatches/VERSION
bash ./compile.sh BOARD=${{env.BOARD}} BRANCH=edge RELEASE=jammy KERNEL_CONFIGURE=no KERNEL_ONLY=no BUILD_DESKTOP=no BUILD_MINIMAL=yes
- name: Release ${{ matrix.board }}
id: release1
continue-on-error: true
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # de2c0eb8 = v0.1.5; already with koplo199's node16 fixes
if: startsWith(github.ref, 'refs/tags/') # only for tags. GitHub requires tags for releases.
with:
files: |
output/images/*.xz
- name: Release ${{ matrix.board }} (retry if 1st failed)
id: release2
if: steps.release1.outcome == 'failure'
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # de2c0eb8 = v0.1.5; already with koplo199's node16 fixes
with:
files: |
output/images/*.xz
- name: Cleanup output images
if: always()
run: |
rm -rf output/images userpatches/VERSION

View File

@@ -24,19 +24,25 @@ jobs:
prepare:
name: "Make JSON"
name: "JSON"
if: ${{ github.repository_owner == 'armbian' }}
runs-on: qemu
outputs:
matrix: ${{steps.json.outputs.JSON_CONTENT}}
steps:
- name: "Fix permissions"
run: |
sudo chown -R $USER.$USER .
- name: Checkout Armbian Framework
uses: actions/checkout@v3.3.0
with:
repository: armbian/build
ref: main
fetch-depth: 1
clean: false
path: build
- name: Checkout Armbian OS Config
@@ -44,10 +50,11 @@ jobs:
with:
repository: armbian/os
ref: main
clean: false
fetch-depth: 1
path: os
- name: "Rsync"
- name: "Rsync userpatches"
run: |
rsync -av os/userpatches/. build/userpatches/
@@ -64,7 +71,7 @@ jobs:
echo 'EOF' >> $GITHUB_OUTPUT
Docker:
name: "B"
name: ":"
needs: [ prepare ]
strategy:
fail-fast: false # let other jobs try to complete if one fails
@@ -79,7 +86,7 @@ jobs:
RUNNER_TAG: "${{ matrix.runner_tag }}"
OCI_TARGET_BASE: "ghcr.io/${{ github.repository }}/" # This is picked up by the Docker launcher automatically
runs-on: ubuntu-latest
runs-on: qemu
steps:
@@ -91,7 +98,7 @@ jobs:
username: ${{ github.repository_owner }} # GitHub username or org
password: ${{ secrets.GITHUB_TOKEN }} # GitHub actions builtin token. repo has to have pkg access.
- name: Checkout build repo
- name: Checkout Armbian build repo
uses: actions/checkout@v3 # We don't need to clone git, really. A wget would suffice for GH-hosted runners. But using clone is better for Igor-hosted runners.
with:
repository: armbian/build #${{ github.repository_owner }}/armbian-build
@@ -109,25 +116,32 @@ jobs:
clean: false
path: os
- name: "Rsync"
- name: "Rsync userpatches"
run: |
rsync -av os/userpatches/. build/userpatches/
- name: Create rootfs ${{env.RELEASE}}:${{env.ARCH}} (variant ${{env.VARIANT}}) (desktop ${{env.DESKTOP}})
- name: Create images BOARD="${{env.BOARD}}" BRANCH="${{env.BRANCH}}" RELEASE="${{env.RELEASE}}"
id: rootfs
run: |
cd build
echo "${{ inputs.version }}" > userpatches/VERSION
bash ./compile.sh armbian-images BOARD="${{env.BOARD}}" BRANCH="${{env.BRANCH}}" RELEASE="${{env.RELEASE}}" BUILD_DESKTOP=no BUILD_MINIMAL=no COMPRESS_OUTPUTIMAGE=sha,img,xz
- name: "Upload artefacts"
uses: ncipollo/release-action@v1
with:
artifacts: "build/output/images/*.*"
artifacts: "build/output/images/Armbian_${{ inputs.version }}*.*"
tag: "${{ inputs.version }}"
omitBody: true
replacesArtifacts: true
omitName: true
allowUpdates: true
artifactErrorsFailBuild: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Cleanup
run: |
rm -f build/output/images/*