forked from rmandrad/Openwrt_Builder
-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (101 loc) · 3.88 KB
/
BPI-r4_build.yaml
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
name: Build OpenWrt for BananaPI BPI-R4 and upload to releases
on:
push:
tags:
- "v*"
workflow_dispatch:
env:
REMOTE_REPOSITORY: N-Storm/openwrt
REMOTE_BRANCH: bananapi4
CONFIG_FILE: config-nstorm-bananapi-bpi-r4
RELEASE_PREFIX: nstorm-bpi-r4
jobs:
build:
name: Build OpenWrt
runs-on: ubuntu-24.04
steps:
- name: Install dependencies
run: |
sudo apt update
sudo apt full-upgrade -y
sudo apt install -y build-essential clang flex bison g++ gawk gcc-multilib g++-multilib gettext git libncurses5-dev libssl-dev python3-setuptools rsync swig unzip zlib1g-dev file wget jq
- name: Checkout remote repository
uses: actions/checkout@v4
with:
repository: ${{ env.REMOTE_REPOSITORY }}
ref: ${{ env.REMOTE_BRANCH }}
- name: Update and install feeds
run: |
./scripts/feeds update -a
./scripts/feeds install -a
- name: Configure firmware image
run: |
cat ${{ env.CONFIG_FILE }} > .config
make defconfig
- name: Try to fetch dependencies cache
uses: actions/cache/restore@v4
with:
path: dl
key: dl-${{ runner.os }}-${{ github.run_id }}
restore-keys: dl-${{ runner.os }}
- name: Download dependencies
run: make -j$(($(nproc)+1)) download
- name: Update dependencies cache every run
uses: actions/cache/save@v4
with:
path: dl
key: dl-${{ runner.os }}-${{ github.run_id }} # Can use time based key as well
- name: Try to fetch host packages and toolchain cache
uses: actions/cache/restore@v4
with:
path: |
staging_dir/host
staging_dir/hostpkg
staging_dir/toolchain-aarch64_cortex-a53_gcc-14.2.0_musl
key: toolchain-${{ runner.os }}-${{ github.run_id }}
restore-keys: toolchain-${{ runner.os }}
- name: Build the firmware image
run: ntry=1; while [[ $ntry -le 3 ]]; do make -j$(($(nproc)+1)) world && ntry=5 || (( ntry++ )); [[ $ntry -eq 4 ]] && exit 255; true; done
- name: Update host packages and toolchain cache
uses: actions/cache/save@v4
with:
path: |
staging_dir/host
staging_dir/hostpkg
staging_dir/toolchain-aarch64_cortex-a53_gcc-14.2.0_musl
key: toolchain-${{ runner.os }}-${{ github.run_id }}
- name: Package output
run: tar -cvf bpi_r4-images.tar bin/targets/mediatek/filogic
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: bpi_r4-images
path: bpi_r4-images.tar
release:
name: Create release
needs: [build]
if: needs.build.result == 'success'
runs-on: ubuntu-24.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: bpi_r4-images
- name: Extract artifacts
run: tar xf bpi_r4-images.tar
- name: Get current date and release version
run: |
echo "RELEASE_DATE=$(date +%F)" >> $GITHUB_ENV
echo -n "BUILD_VER_STR=$( cat bin/targets/mediatek/filogic/profiles.json | jq -r '.profiles.[].image_prefix' | sed -E 's/openwrt-(v24-snapshot-.*?-r[0-9]{2,3})-mediatek-filogic-bananapi_bpi-r4/\1/' )" >> $GITHUB_ENV
- name: Create release
uses: softprops/[email protected]
with:
files: bin/targets/mediatek/filogic/*
prerelease: true
tag_name: ${{ env.RELEASE_PREFIX }}-${{ env.BUILD_VER_STR }}
name: (AUTO) NStorm-BPI-R4-${{ env.BUILD_VER_STR }}
body: |
(!) Automated and untested / experimental build.
Image version: NStorm-BPI-R4-${{ env.BUILD_VER_STR }}
Uploaded on: ${{ env.RELEASE_DATE }}
Build Commit: ${{ needs.check_commits.outputs.latest_commit_sha }}