Files
scripts/.github/workflows/build-u-boot-cache.yml
dependabot[bot] dac0bc730c Bump actions/checkout from 3 to 4 (#56)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-30 09:20:38 +01:00

123 lines
4.1 KiB
YAML

name: Build U-boot cache
on:
workflow_dispatch:
workflow_call:
inputs:
ACCESS_NAME:
required: false
type: string
default: ${{ github.repository_owner }}
BUILD_BRANCH:
required: false
type: string
default: 'main'
BUILD_RUNNER:
required: false
type: string
default: "ubuntu-latest"
secrets:
ACCESS_TOKEN:
required: true
KEY_TORRENTS:
required: false
KNOWN_HOSTS_UPLOAD:
required: false
jobs:
prepare:
name: "Make JSON"
if: ${{ github.repository_owner == 'armbian' }}
runs-on: ubuntu-latest
outputs:
matrix: ${{steps.json.outputs.JSON_CONTENT}}
steps:
- name: "Fix permissions"
run: |
sudo chown -R $USER.$USER .
- name: Checkout Armbian Framework
uses: actions/checkout@v4
with:
repository: armbian/os
ref: main
fetch-depth: 1
clean: false
- name: Build JSON
id: json
run: |
# Make a list of valid pairs from our config
echo 'JSON_CONTENT<<EOF' >> $GITHUB_OUTPUT
cat targets/*.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
uboot:
if: ${{ github.repository_owner == 'armbian' }}
needs: [ prepare ]
name: "${{ matrix.board }}"
runs-on: [ "${{ inputs.BUILD_RUNNER }}" ]
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.prepare.outputs.matrix) }}
env:
BOARD: "${{ matrix.board }}"
BRANCH: "${{ matrix.branch }}"
VARIANT: "${{ matrix.variant }}"
steps:
- name: "Fix permissions"
run: |
sudo chown -R $USER.$USER .
# Login to ghcr.io, for later uploading rootfs to ghcr.io
- name: Docker Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ inputs.ACCESS_NAME }} # GitHub username or org
password: ${{ secrets.ACCESS_TOKEN }} # GitHub actions builtin token. repo has to have pkg access.
- name: Checkout build repo
uses: actions/checkout@v4 # 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: ${{ inputs.BUILD_BRANCH }}
fetch-depth: 1
clean: false
- 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}}" "FORCE_ARTIFACTS_DOWNLOAD=yes" "SHARE_LOG=yes" ${{env.VARIANT}}
- name: "Generate key id" # We need this in case we run multiple runners on one machine
run: echo "RANDOM=ID_$((RANDOM%100000000))" >> $GITHUB_ENV
shell: bash
- name: Install SSH key for storage
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.KEY_TORRENTS }}
name: ${{ env.RANDOM }}
known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }}
if_key_exists: replace
- name: Deploy to server
if: ${{ github.repository_owner == 'Armbian' }}
run: |
if ! command -v "lftp" > /dev/null 2>&1; then
sudo apt-get -y -qq install lftp
fi
lftp -u upload, -e "set sftp:connect-program ssh -ax -i $HOME/.ssh/${{ env.RANDOM }}; set net:timeout 4;set net:max-retries 6;mirror -R --include-glob *.deb --no-empty-dirs --parallel=8 --no-perms output/debs/. debs-beta/ ;bye" sftp://users.armbian.com