Create include.yml

This commit is contained in:
Igor Pečovnik
2023-02-19 16:49:06 +01:00
committed by GitHub
parent 22575f72e0
commit 24e7a7814b

83
.github/include.yml vendored Normal file
View File

@@ -0,0 +1,83 @@
name: uboot-simple
on:
workflow_dispatch:
workflow_call:
inputs:
include:
required: false
type: string
exclude:
required: false
type: string
runner:
required: true
type: string
jobs:
prepare:
name: "Make JSON"
if: ${{ github.repository_owner == 'armbian' }}
runs-on: ubuntu-latest
outputs:
matrix: ${{steps.json.outputs.JSON_CONTENT}}
steps:
- name: Checkout Armbian Framework
uses: actions/checkout@v3.3.0
with:
repository: armbian/build
ref: main
fetch-depth: 1
clean: false # true is default. it *will* delete the hosts /dev if mounted inside.
- name: Build JSON
id: json
run: |
# Make a list of valid pairs from our config
echo 'JSON_CONTENT<<EOF' >> $GITHUB_OUTPUT
cat config/target*.conf | grep -v "^$" | grep -v "^#" | ${{ inputs.include }} ${{ inputs.exclude }} sed 's/\s\s*/ /g' | cut -d' ' -f1,2 | sed 's/ / /g' | sort | uniq | awk '{ printf "%s%s\n", "{\"board\":\""$1"\",", "\"branch\":\""$2"\"}" }' | jq -s >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
"u-boot":
if: ${{ github.repository_owner == 'armbian' }}
needs: [ prepare ]
strategy:
fail-fast: false # let other jobs try to complete if one fails
matrix:
include: ${{ fromJSON(needs.prepare.outputs.matrix) }}
runs-on: "${{ inputs.runner }}"
name: "${{ matrix.board }}"
env:
BOARD: "${{ matrix.board }}"
BRANCH: "${{ matrix.branch }}"
VARIANT: "${{ matrix.variant }}"
OCI_TARGET_BASE: "ghcr.io/${{ github.repository }}/" # This is picked up by the Docker launcher automatically
steps:
# Login to ghcr.io, for later uploading rootfs to ghcr.io
- name: Docker Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
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
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
ref: main
fetch-depth: 1
clean: false # true is default. it *will* delete the hosts /dev if mounted inside.
- name: Build U-Boot ${{env.BOARD}}:${{env.BRANCH}} (variant ${{env.VARIANT}})
id: uboot
run: |
# BRANCH and BOARD are in the env, but Docker doesn't know that; (sudo has --preserve-env). So we need to pass them as args.
# let VARIANT expand
# SHARE_LOG=yes to share logs to pastebin
bash ./compile.sh uboot \
"BRANCH=${{env.BRANCH}}" "BOARD=${{env.BOARD}}" ${{env.VARIANT}} \
SHARE_LOG=yes