forked from hugcabbage/shared-lede
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.yml.example
154 lines (137 loc) · 4.63 KB
/
build.yml.example
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#
# Copyright (C) 2022 hugcabbage <[email protected]>
#
# This is free software, licensed under the MIT License.
#
# <https://github.com/hugcabbage/shared-lede>
#
name: xxxxxx
on:
workflow_dispatch:
inputs:
build:
description: 'want to compile? input true'
required: true
default: 'true'
type: string
record:
description: 'input version description'
required: false
default: 'details: kernel bumped, application version updated'
type: string
release:
description: 'upload firmware to release'
required: false
default: true
type: boolean
artifact:
description: 'upload firmware to artifact'
required: false
default: false
type: boolean
jobs:
build:
if: inputs.build == 'true'
runs-on: ubuntu-latest
env:
SERIAL_NU: xxxxxx
DEPLOYDIR: xxxxxx
steps:
- name: display initial disk space
run: |
df -h
- name: Checkout
uses: actions/checkout@v3
- name: prepare environments
run: |
sudo apt-get update
sudo apt-get -y install \
antlr3 asciidoc autoconf automake autopoint binutils build-essential \
bzip2 device-tree-compiler flex g++-multilib gawk gcc-multilib \
gettext git gperf lib32gcc1 libc6-dev-i386 libelf-dev libglib2.0-dev \
libncurses5-dev libssl-dev libtinfo5 libtool libz-dev msmtp p7zip \
p7zip-full patch python3 qemu-utils subversion swig texinfo uglifyjs \
unzip upx xmlto zip zlib1g-dev
sudo apt-get clean
- name: clone sources
run: |
CLONE_SH=${DEPLOYDIR}/${SERIAL_NU}.clone.sh
chmod +x $CLONE_SH
$CLONE_SH
- name: update feeds
run: |
./scripts/feeds update -a
./scripts/feeds install -a
- name: modify configuration
run: |
MODIFY_SH=${DEPLOYDIR}/${SERIAL_NU}.modify.sh
chmod +x $MODIFY_SH
$MODIFY_SH
- name: generate .config
run: |
DOT_CONFIG=${DEPLOYDIR}/${SERIAL_NU}.config
mv $DOT_CONFIG .config
make defconfig
- name: make download
run: |
make download -j8 || make download -j1 V=s
- name: compile
run: |
make -j$(nproc) || make -j1 V=s
- name: pick up files
run: |
mkdir -p collected_firmware/packages
rm -rf $(find bin/targets/ -type d -name 'packages')
cp $(find bin/targets/ -type f) collected_firmware
cp $(find bin/packages/ -type f -name '*.ipk') collected_firmware/packages
cd collected_firmware
zip -r allfiles.zip *
cd packages
zip -r ../packages.zip *
- name: read release text
id: release-text
if: inputs.release == true && env.RELEASE_FIRMWARE_VALUE != ''
env:
RELEASE_FIRMWARE_VALUE: ${{ secrets.RELEASE_FIRMWARE }}
run: |
RELEASE_TEXT=${DEPLOYDIR}/${SERIAL_NU}.release.yml
echo "RELEASE_TITLE=$(yq '.[].title' $RELEASE_TEXT)" >> $GITHUB_OUTPUT
echo 'RELEASE_BODY<<EOF' >> $GITHUB_OUTPUT
yq '.[].body[]' $RELEASE_TEXT >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: calculate tag version
id: tag-version
if: steps.release-text.conclusion == 'success'
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.RELEASE_FIRMWARE }}
dry_run: true
- name: upload firmware to release
id: to-release
if: steps.release-text.conclusion == 'success'
continue-on-error: true
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.RELEASE_FIRMWARE }}
file: collected_firmware/*
tag: ${{ steps.tag-version.outputs.new_tag }}
release_name: ${{ steps.tag-version.outputs.new_version }} ${{ steps.release-text.outputs.RELEASE_TITLE }}
overwrite: true
prerelease: false
body: |
${{ steps.release-text.outputs.RELEASE_BODY }}
${{ inputs.record }}
file_glob: true
- name: upload firmware to artifact
if: inputs.artifact == true || steps.to-release.outcome != 'success'
uses: actions/upload-artifact@v3
with:
name: collected_firmware
path: |
collected_firmware/
!collected_firmware/*.zip
- name: display finishing disk space
run: |
df -h
echo "----------------------------"
du -h --max-depth=1