DietPi-Software build #120
This file contains hidden or 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: [amiberry, amiberry-lite, amiberry+lite, domoticz, gzdoom, gmediarender, gogs, shairport-sync, squeezelite, unbound, 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: [bookworm, trixie, forky, 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 }} | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - id: name | |
| run: | | |
| if [ '${{ github.event.inputs.name }}' = 'all' ] | |
| then | |
| echo 'name=["amiberry", "amiberry-lite", "domoticz", "gzdoom", "gmediarender", "gogs", "shairport-sync", "squeezelite", "unbound", "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=["bookworm", "trixie", "forky"]' >> "$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: bookworm } | |
| - { arch: aarch64, name: gogs } | |
| - { arch: x86_64, name: gogs } | |
| - { arch: armv6l, name: amiberry-lite } | |
| - { arch: armv6l, name: gzdoom } | |
| - { arch: armv7l, name: gzdoom } | |
| fail-fast: false | |
| name: "${{ matrix.name }} - ${{ matrix.arch }} - ${{ matrix.dist }}" | |
| runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }} | |
| steps: | |
| - name: Build | |
| run: sudo bash -c "G_GITOWNER=$GITHUB_REPOSITORY_OWNER G_GITBRANCH=$GITHUB_REF_NAME GH_TOKEN='${{ github.token }}'; $(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]}" |