DietPi-Software build #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DietPi-Software build | |
on: | |
workflow_dispatch: | |
inputs: | |
name: | |
description: 'Software title' | |
type: choice | |
options: [gmediarender, gogs, shairport-sync, squeezelite, vaultwarden, ympd, all] | |
default: all | |
required: true | |
arch: | |
description: 'Target architecture' | |
type: choice | |
options: [armv6l, armv7l, aarch64, x86_64, riscv64, all] | |
default: all | |
required: true | |
dist: | |
description: 'Target Debian version' | |
type: choice | |
options: [bullseye, bookworm, trixie, all] | |
default: all | |
required: true | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.inputs.name }}-${{ github.event.inputs.arch }}-${{ github.event.inputs.dist }} | |
cancel-in-progress: true | |
permissions: {} | |
jobs: | |
prep: | |
outputs: | |
name: ${{ steps.name.outputs.name }} | |
arch: ${{ steps.arch.outputs.arch }} | |
dist: ${{ steps.dist.outputs.dist }} | |
# https://github.com/actions/runner-images | |
runs-on: ubuntu-22.04 | |
steps: | |
- id: name | |
run: | | |
if [ '${{ github.event.inputs.name }}' = 'all' ] | |
then | |
echo 'name=["gmediarender", "gogs", "shairport-sync", "squeezelite", "vaultwarden", "ympd"]' >> "$GITHUB_OUTPUT" | |
else | |
echo 'name=["${{ github.event.inputs.name }}"]' >> "$GITHUB_OUTPUT" | |
fi | |
- id: arch | |
run: | | |
if [ '${{ github.event.inputs.arch }}' = 'all' ] | |
then | |
echo 'arch=["armv6l", "armv7l", "aarch64", "x86_64", "riscv64"]' >> "$GITHUB_OUTPUT" | |
else | |
echo 'arch=["${{ github.event.inputs.arch }}"]' >> "$GITHUB_OUTPUT" | |
fi | |
- id: dist | |
run: | | |
if [ '${{ github.event.inputs.dist }}' = 'all' ] | |
then | |
echo 'dist=["bullseye", "bookworm", "trixie"]' >> "$GITHUB_OUTPUT" | |
else | |
echo 'dist=["${{ github.event.inputs.dist }}"]' >> "$GITHUB_OUTPUT" | |
fi | |
build: | |
needs: prep | |
strategy: | |
matrix: | |
name: ${{ fromJson(needs.prep.outputs.name) }} | |
arch: ${{ fromJson(needs.prep.outputs.arch) }} | |
dist: ${{ fromJson(needs.prep.outputs.dist) }} | |
exclude: | |
- { arch: riscv64, dist: bullseye } | |
- { arch: riscv64, dist: bookworm } | |
- { arch: armv7l, name: gogs } | |
- { arch: aarch64, name: gogs } | |
- { arch: x86_64, name: gogs } | |
fail-fast: false | |
name: "${{ matrix.name }} - ${{ matrix.arch }} - ${{ matrix.dist }}" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Build | |
run: sudo bash -c "G_GITOWNER=$GITHUB_REPOSITORY_OWNER G_GITBRANCH=$GITHUB_REF_NAME; $(curl -sSf "https://raw.githubusercontent.com/$GITHUB_REPOSITORY_OWNER/DietPi/$GITHUB_REF_NAME/.build/software/dietpi-software-build.bash")" -- -n '${{ matrix.name }}' -a '${{ matrix.arch }}' -d '${{ matrix.dist }}' | |
- name: Upload | |
run: | | |
# SSH server and client keys | |
mkdir ~/.ssh | |
umask 377 | |
echo '${{ secrets.KNOWN_HOSTS }}' > ~/.ssh/known_hosts | |
echo '${{ secrets.SSH_KEY }}' > ~/.ssh/id_ed25519 | |
# Generate file lists | |
files= | |
urls='"https://dietpi.com/downloads/binaries/${{ matrix.dist }}/testing/"' | |
cd rootfs/output | |
for i in * | |
do | |
files="$files,$i" | |
urls="$urls,\"https://dietpi.com/downloads/binaries/${{ matrix.dist }}/testing/$i\"" | |
done | |
files=${files#,} | |
echo "Uploading file(s) $files to URL(s) $urls ..." | |
# Upload | |
curl -T "{$files}" --key ~/.ssh/id_ed25519 '${{ secrets.UPLOAD_URL }}${{ matrix.dist }}/' | |
curl 'https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE }}/purge_cache' -H 'Authorization: Bearer ${{ secrets.CF_TOKEN }}' -H 'Content-Type: application/json' --data "{\"files\":[$urls]}" |