Files
os/.github/workflows/include.yml
Igor Pečovnik 8593d22650 Update build-images.yml
Signed-off-by: Igor <igor@armbian.com>
2023-02-21 12:23:48 +01:00

147 lines
4.3 KiB
YAML

name: Reusable
on:
workflow_call:
inputs:
config:
required: true
type: string
branch:
required: false
type: string
release:
required: false
type: string
variant:
required: false
type: string
version:
required: false
type: string
jobs:
prepare:
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
uses: actions/checkout@v3.3.0
with:
repository: armbian/os
ref: main
clean: false
fetch-depth: 1
path: os
- name: "Rsync userpatches"
run: |
rsync -av os/userpatches/. build/userpatches/
- name: "Make JSON"
id: json
run: |
echo "Version: ${{ inputs.version }}"
# Make a list of valid pairs from our config
echo 'JSON_CONTENT<<EOF' >> $GITHUB_OUTPUT
cat os/targets/${{ inputs.config }} | grep -v "^$" | grep -v "^#" | grep "${{ inputs.branch }}" | grep "${{ inputs.release }}" | grep "${{ inputs.variant }}" | awk '{print "{\"board\":\""$1"\",\"branch\":\""$2"\",\"release\":\""$3"\",\"variant\":\""$4"\",\"runner_tag\":\"qemu\"}"}' | jq $FILTER | jq -s >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
Docker:
name: ":"
needs: [ prepare ]
strategy:
fail-fast: false # let other jobs try to complete if one fails
matrix:
include: ${{ fromJSON(needs.prepare.outputs.matrix) }}
env:
BOARD: "${{ matrix.board }}"
BRANCH: "${{ matrix.branch }}"
RELEASE: "${{ matrix.release }}"
VARIANT: "${{ matrix.variant }}"
RUNNER_TAG: "${{ matrix.runner_tag }}"
OCI_TARGET_BASE: "ghcr.io/${{ github.repository }}/" # This is picked up by the Docker launcher automatically
runs-on: qemu
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 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
ref: main
fetch-depth: 1
clean: false
path: build
- name: Checkout Armbian OS Config
uses: actions/checkout@v3.3.0
with:
repository: armbian/os
ref: main
fetch-depth: 1
clean: false
path: os
- name: "Rsync userpatches"
run: |
rsync -av os/userpatches/. build/userpatches/
- 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/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/*