-
Notifications
You must be signed in to change notification settings - Fork 696
/
Copy pathbuild.yml
160 lines (141 loc) · 4.58 KB
/
build.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
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
155
156
157
158
159
160
#
# Copyright (C) 2022-2024 hugcabbage <[email protected]>
#
# This is free software, licensed under the MIT License.
#
# <https://github.com/hugcabbage/shared-lede>
#
name: xxxxxx??name
on:
workflow_dispatch:
inputs:
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
permissions:
contents: write
jobs:
to-build:
name: build
runs-on: ubuntu-latest
env:
EXTRA_STR: _some
steps:
- name: Display initial disk space
run: |
df -h
- name: Checkout
uses: actions/checkout@v4
with:
path: ${{ env.EXTRA_STR }}
- name: Prepare environments
run: |
sudo apt-get update
sudo apt-get -y install gcc-multilib gettext
sudo apt-get clean
- name: Prepare deployment
id: prepare-deployment
env:
SERIAL: xxxxxx??serial
DEPLOY_DIR: ${{ env.EXTRA_STR }}/xxxxxx??deploy
run: |
CLONE_SH=$DEPLOY_DIR/$SERIAL.clone.sh
echo "modelname=${GITHUB_WORKFLOW#* }" >> "$GITHUB_OUTPUT"
echo "codedir=$(grep '^CODE_DIR=' $CLONE_SH | cut -d '=' -f 2)" >> "$GITHUB_OUTPUT"
echo "clone_sh=$CLONE_SH" >> "$GITHUB_OUTPUT"
echo "modify_sh=$DEPLOY_DIR/$SERIAL.modify.sh" >> "$GITHUB_OUTPUT"
echo "dot_config=$DEPLOY_DIR/$SERIAL.config" >> "$GITHUB_OUTPUT"
- name: Clone sources
env:
CLONE_SH: ${{ steps.prepare-deployment.outputs.clone_sh }}
run: |
chmod +x $CLONE_SH
$CLONE_SH
- name: Update feeds
run: |
./scripts/feeds update -a
./scripts/feeds install -a
- name: Modify configuration
env:
MODIFY_SH: ${{ steps.prepare-deployment.outputs.modify_sh }}
run: |
chmod +x $MODIFY_SH
$MODIFY_SH
- name: Generate .config
env:
DOT_CONFIG: ${{ steps.prepare-deployment.outputs.dot_config }}
run: |
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: Generate summary
continue-on-error: true
id: generate-summary
env:
MODEL_NAME: ${{ steps.prepare-deployment.outputs.modelname }}
CODE_DIR: ${{ steps.prepare-deployment.outputs.codedir }}
TRANSIT_PY: ${{ env.EXTRA_STR }}/extra-files/transit.py
run: |
chmod +x $TRANSIT_PY
$TRANSIT_PY
- name: Calculate tag version
id: calculate-version
if: inputs.release
uses: hugcabbage/next-version@v1
with:
repo_path: ${{ env.EXTRA_STR }}
- name: Upload firmware to release
id: to-release
if: steps.calculate-version.conclusion == 'success' && inputs.release
continue-on-error: true
uses: svenstaro/upload-release-action@v2
with:
file: _collected_firmware/*
tag: ${{ steps.calculate-version.outputs.version }}
release_name: ${{ steps.calculate-version.outputs.version }} ${{ steps.generate-summary.outputs.stitle }}
overwrite: true
prerelease: false
body: |
${{ inputs.record }}
${{ steps.generate-summary.outputs.summary }}
file_glob: true
- name: Upload firmware to artifact
if: inputs.artifact || steps.to-release.outcome != 'success'
uses: actions/upload-artifact@v4
with:
name: collected_firmware
path: |
_collected_firmware/
!_collected_firmware/*.zip
- name: Display finishing disk space
run: |
df -h
echo "----------------------------"
du -h --max-depth=1