-
Notifications
You must be signed in to change notification settings - Fork 7
195 lines (172 loc) · 6.65 KB
/
Copy pathopenwrt-release.yml
File metadata and controls
195 lines (172 loc) · 6.65 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
permissions:
contents: write
name: Build OpenWrt Package
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
test:
name: Functional tests
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Run functional tests
run: bash tests/run_tests.sh
build:
name: Build for ${{ matrix.version }} / ${{ matrix.target }}
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
env:
REPO_APK_KEY: ${{ secrets.REPO_APK_KEY }}
strategy:
fail-fast: false
matrix:
include:
- version: openwrt-24.10
target: x86_64
suffix: all
# - version: openwrt-24.10
# target: aarch64_cortex-a53
# - version: openwrt-24.10
# target: aarch64_generic
# - version: openwrt-24.10
# target: arm_cortex-a7
# - version: openwrt-24.10
# target: arm_cortex-a9
# - version: openwrt-24.10
# target: mips_24kc
# - version: openwrt-24.10
# target: mipsel_24kc
- version: openwrt-25.12
target: x86_64
suffix: noarch
# - version: openwrt-25.12
# target: aarch64_cortex-a53
# - version: openwrt-25.12
# target: aarch64_generic
# - version: openwrt-25.12
# target: arm_cortex-a7
# - version: openwrt-25.12
# target: arm_cortex-a9
# - version: openwrt-25.12
# target: mips_24kc
# - version: openwrt-25.12
# target: mipsel_24kc
steps:
- name: 🧾 Checkout repo
uses: actions/checkout@v4
- name: 📛 Set PKG_NAME from repo
run: echo "PKG_NAME=${{ github.event.repository.name }}" >> "$GITHUB_ENV"
- name: 🧰 Set up melmac feed structure
run: |
set -e
# Also add a shim so ../../luci.mk from package/feeds/melmac/<pkg> works:
mkdir -p package
printf 'include $(TOPDIR)/feeds/luci/luci.mk\n' > package/luci.mk
# LuCI-style layout so ../../luci.mk resolves from applications/<pkg>
mkdir -p feed/luci/applications/${PKG_NAME}
# Add shim luci/luci.mk pointing to the official LuCI feed
mkdir -p feed/luci
printf 'include $(TOPDIR)/feeds/luci/luci.mk\n' > feed/luci/luci.mk
# Copy the package sources into the feed subdir (exclude CI and feed itself)
rsync -av \
--exclude='.git' \
--exclude='feed' \
--exclude='.github' \
./ feed/luci/applications/${PKG_NAME}/
- name: 🧮 Compute ARCH
run: |
if [ "${{ matrix.version }}" = "snapshots" ]; then
echo "ARCH=${{ matrix.target }}-SNAPSHOT" >> "$GITHUB_ENV"
else
echo "ARCH=${{ matrix.target }}-${{ matrix.version }}" >> "$GITHUB_ENV"
fi
- name: 🏗️ Build with OpenWrt SDK
uses: openwrt/gh-action-sdk@v8
env:
ARCH: ${{ env.ARCH }}
FEEDNAME: melmac
PACKAGES: ${{ env.PKG_NAME }}
INDEX: 0
FEED_DIR: ${{ github.workspace }}/feed
NO_SHFMT_CHECK: 1
NO_REFRESH_CHECK: 1
PRIVATE_KEY: ${{ secrets.REPO_APK_KEY }}
- name: 🔍 Debug build output
run: |
echo "=== Build directory structure ==="
find . -name "*.ipk" -type f 2>/dev/null || echo "No .ipk files found"
echo "=== bin directory structure ==="
ls -la bin/ 2>/dev/null || echo "No bin directory found"
if [ -d "bin/packages" ]; then
echo "=== packages directory structure ==="
find bin/packages/ -type f -name "*.ipk" 2>/dev/null || echo "No .ipk files in packages directory"
echo "=== Full packages directory tree ==="
ls -laR bin/packages/ 2>/dev/null || echo "No packages directory"
fi
- name: 🏷️ Rename APK with version and target
run: |
set -euo pipefail
PKG_VERSION=$(grep -E '^PKG_VERSION *:?=' Makefile | head -n1 | cut -d= -f2 | tr -d '[:space:]')
PKG_RELEASE=$(grep -E '^PKG_RELEASE *:?=' Makefile | head -n1 | cut -d= -f2 | tr -d '[:space:]')
for ext in ipk apk; do
for f in $(find bin/packages -type f -path "*/melmac/*.${ext}"); do
dir=$(dirname "$f")
if [ -n "${{ matrix.suffix }}" ]; then
mv -v "$f" "$dir/${PKG_NAME}-${PKG_VERSION}-${PKG_RELEASE}_${{ matrix.version }}_${{ matrix.suffix }}.${ext}"
else
mv -v "$f" "$dir/${PKG_NAME}-${PKG_VERSION}-${PKG_RELEASE}_${{ matrix.version }}_${{ matrix.target }}.${ext}"
fi
done
done
- name: 📦 Upload artifact for ${{ matrix.target }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}-${{ matrix.target }}-${{ matrix.version }}
path: |
bin/packages/*/melmac/${{ env.PKG_NAME }}*.ipk
bin/packages/*/melmac/${{ env.PKG_NAME }}*.apk
# bin/packages/*/melmac/Packages*
# bin/packages/*/melmac/index.json
# bin/packages/*/melmac/packages.adb
if-no-files-found: ignore
release:
name: Release ${{ github.repository }}
needs: build
runs-on: ubuntu-latest
steps:
- name: 🧾 Checkout repo
uses: actions/checkout@v4
- name: 🔍 Extract version and release from Makefile
id: version
run: |
PKG_VERSION=$(grep -E '^PKG_VERSION *:?=' Makefile | head -n1 | cut -d= -f2 | tr -d '[:space:]')
PKG_RELEASE=$(grep -E '^PKG_RELEASE *:?=' Makefile | head -n1 | cut -d= -f2 | tr -d '[:space:]')
COMBINED_VERSION="${PKG_VERSION}-${PKG_RELEASE}"
echo "📦 Version: $COMBINED_VERSION"
echo "version=$COMBINED_VERSION" >> "$GITHUB_OUTPUT"
- name: ⬇️ Download all build artifacts
uses: actions/download-artifact@v4
with:
path: ./release-assets
- name: 🗃️ Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
name: Build v${{ steps.version.outputs.version }}
files: |
./release-assets/**/*.ipk
./release-assets/**/*.apk
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}