Files
scripts/.github/workflows/build-desktop.yml
2021-12-24 23:12:44 +01:00

169 lines
5.0 KiB
YAML

name: Beta Desktop
on:
workflow_dispatch:
workflow_call:
inputs:
uploading:
type: string
secrets:
GPG_KEY1:
required: true
GPG_PASSPHRASE1:
required: true
GPG_KEY2:
required: true
GPG_PASSPHRASE2:
required: true
SCRIPTS_ACCESS_TOKEN:
required: true
KEY_TORRENTS:
required: true
KNOWN_HOSTS_UPLOAD:
required: true
jobs:
Prepare:
name: Build
if: ${{ github.repository_owner == 'Armbian' }}
runs-on: small
outputs:
matrix: ${{steps.list_dirs.outputs.matrix}}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: armbian/build
path: build
ref: nightly
clean: false
- name: Remove previous artefacts if any
run: |
sudo rm -rf changes 2>/dev/null || true
- name: Download changes
uses: actions/download-artifact@v2
with:
name: changes
- name: Build desktops
id: list_dirs
run: |
MATRIX=$(
set +e
releases=($(find build/config/distributions -mindepth 1 -maxdepth 1 -type d | sed 's/.*\///' ))
for i in ${releases[@]}
do
environments=($([[ -d build/config/desktop/$i/environments ]] && ls -1 build/config/desktop/$i/environments))
for j in ${environments[@]}
do
echo "$i:$j"
done
done)
# don't build if there are no changes in kernels
[ -s changes ] || unset MATRIX
echo ::set-output name=matrix::$(for x in $(echo "${MATRIX}"); do echo $x; done|jq -cnR '[inputs | select(length>0)]' | jq)
Desktop:
name: "Build package"
needs: Prepare
if: ${{ needs.Prepare.outputs.matrix != '[]' && needs.Prepare.outputs.matrix != '' }}
runs-on: ubuntu-latest
timeout-minutes: 480
strategy:
fail-fast: false
matrix:
node: ${{fromJson(needs.Prepare.outputs.matrix)}}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: armbian/build
path: build
ref: nightly
clean: true
- name: Checkout support scripts
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: armbian/scripts
path: scripts
clean: true
- name: Pull Docker image
run: |
[[ -z $(command -v docker) ]] && sudo apt-get -yy install docker containerd docker.io
sudo docker kill $(sudo docker ps -q) 2>/dev/null || true
sudo docker pull ghcr.io/armbian/build:$(cat build/VERSION | sed 's/trunk.*/trunk/')"-$(dpkg --print-architecture)"
- name: Build package
run: |
mkdir -p build/userpatches
cp scripts/configs/* build/userpatches/
cd build
CHUNK="${{ matrix.node }}"
RELEASE=$(echo $CHUNK | cut -d":" -f1)
DE=$(echo $CHUNK | cut -d":" -f2)
echo "RELEASE=${RELEASE}" >> $GITHUB_ENV
echo "DE=${DE}" >> $GITHUB_ENV
sed -i "s/-it --rm/-i --rm/" userpatches/config-docker.conf
./compile.sh docker \
BSP_BUILD="yes" \
BETA="yes" \
RELEASE="${RELEASE}" \
DESKTOP_ENVIRONMENT_CONFIG_NAME="config_base" \
BUILD_DESKTOP="yes" \
DESKTOP_ENVIRONMENT="${DE}" \
KERNEL_ONLY="yes" \
KERNEL_CONFIGURE="no" \
BOARD="uefi-x86" \
BRANCH="current" \
SKIP_EXTERNAL_TOOLCHAINS="yes" \
OFFLINE_WORK="yes" \
REPOSITORY_INSTALL="u-boot,kernel,armbian-config,armbian-firmware" \
DESKTOP_APPGROUPS_SELECTED="" \
EXPERT="yes"
if [[ $? -eq 0 ]]; then
echo "UPLOAD=true" >> $GITHUB_ENV
fi
- name: Upload build artifacts
if: ${{ inputs.uploading == true }}
uses: actions/upload-artifact@v2
with:
name: armbian-${{ env.RELEASE }}-desktop-${{ env.DE }}
path: build/output/debs-beta/${{ env.RELEASE }}/armbian-${{ env.RELEASE }}-desktop-${{ env.DE }}_*.deb
if-no-files-found: ignore
retention-days: 30
- name: Install SSH key for storage
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.KEY_TORRENTS }}
known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }}
if_key_exists: replace
- name: Deploy to server
if: ${{ env.UPLOAD == true }}
run: |
sudo apt-get -y -qq install lftp
lftp -u upload, -e "set net:timeout 10;set net:max-retries 16;mirror --Remove-source-files -R --no-empty-dirs --parallel=8 --include-glob=armbian-${{ env.RELEASE }}-desktop-${{ env.DE }}_*.deb --no-perms $(pwd)/build/output/debs-beta/ debs-beta/ ;bye" sftp://users.armbian.com