forked from MichaIng/DietPi
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (122 loc) · 4.8 KB
/
armbian.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Armbian
on:
workflow_dispatch:
inputs:
asset:
description: 'Asset'
type: choice
options: [kernel, uboot, firmware]
default: kernel
required: true
branch:
description: 'Branch'
type: choice
options: [legacy, current, edge, vendor, collabora]
default: current
required: true
board:
description: 'Board'
required: true
gitowner:
description: 'Override Git owner of Armbian repo'
gitbranch:
description: 'Override Git branch of Armbian repo'
rebase:
description: 'Rebase onto latest armbian/main'
type: boolean
default: true
concurrency:
group: ${{ github.workflow }}-${{ github.event.inputs.asset }}-${{ github.event.inputs.branch }}-${{ github.event.inputs.board }}
cancel-in-progress: true
permissions: {}
jobs:
build:
name: "${{ github.event.inputs.asset }} - ${{ github.event.inputs.branch }} - ${{ github.event.inputs.board }}"
# https://github.com/actions/runner-images
runs-on: ubuntu-24.04
steps:
- name: Clone Armbian repo
run: |
owner='${{ github.event.inputs.gitowner }}'
[ "$owner" ] || owner='MichaIng'
branch='${{ github.event.inputs.gitbranch }}'
[ "$branch" ] || branch='dietpi'
git clone -b "$branch" "https://github.com/$owner/build"
[ '${{ github.event.inputs.rebase }}' == 'false' ] && exit 0 || :
cd build
git config user.name "$GITHUB_REPOSITORY_OWNER"
git config user.email '${{ github.repository.owner.email }}'
if [ "$owner" != 'MichaIng' ]
then
git remote add dietpi https://github.com/MichaIng/build
git fetch dietpi dietpi
git rebase dietpi/dietpi
elif [ "$branch" != 'dietpi' ]
then
git fetch origin dietpi
git rebase origin/dietpi
fi
if [ "$owner" != 'armbian' ]
then
git remote add upstream https://github.com/armbian/build
git fetch upstream main
git rebase upstream/main
elif [ "$branch" != 'main' ]
then
git fetch origin main
git rebase origin/main
fi
- name: Obtain version suffix
run: |
cd build
read -r version < VERSION
case '${{ github.event.inputs.asset }}' in
firmware) package='armbian-firmware';;
uboot) package='linux-u-boot-${{ github.event.inputs.board }}-${{ github.event.inputs.branch }}';;
kernel)
family=$(. 'config/boards/${{ github.event.inputs.board }}.'* &> /dev/null; echo "$BOARDFAMILY")
echo "Board family is: $family"
family=$(BRANCH='${{ github.event.inputs.branch }}'; . "config/sources/families/$family.conf" &> /dev/null; echo "$LINUXFAMILY")
echo "Linux family is: $family"
package="linux-dtb-${{ github.event.inputs.branch }}-$family"
;;
*) echo 'ERROR: Invalid asset "${{ github.event.inputs.asset }}"'; exit 1;;
esac
if curl -fO "https://dietpi.com/downloads/binaries/$package.deb"
then
cur_version=$(dpkg-deb -f "$package.deb" Version)
rm "$package.deb"
cur_suffix=${cur_version#*-dietpi}
echo "Current package version is: $cur_version"
fi
echo "New Armbian version is: $version"
[ "$version-dietpi$cur_suffix" = "$cur_version" ] && version="$version-dietpi$((cur_suffix+1))" || version="$version-dietpi1"
echo "New package version will be: $version"
echo "$version" > VERSION
- name: Build asset
run: |
cd build
./compile.sh '${{ github.event.inputs.asset }}' BRANCH='${{ github.event.inputs.branch }}' BOARD='${{ github.event.inputs.board }}'
- 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/testing/"'
cd build/output/debs
for i in *
do
mv -v "$i" "${i%%_*}.deb"
i="${i%%_*}.deb"
files="$files,$i"
urls="$urls,\"https://dietpi.com/downloads/binaries/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 }}all/'
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]}"