Skip to content

Commit f87da23

Browse files
committed
updating packageing and versioning strategy
1 parent a171fdb commit f87da23

7 files changed

Lines changed: 117 additions & 58 deletions

File tree

.github/workflows/assemblefirmware.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ jobs:
160160
./compile_packages.sh -t ${{ matrix.target }} -o ${{ matrix.openwrt }}
161161
162162
- name: upload packages directory
163-
if: github.event_name == 'push'
163+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
164164
env:
165165
SSH_KEY: ${{ secrets.BUILDBOT_PRIVATE_KEY }}
166166
run: |
@@ -172,28 +172,47 @@ jobs:
172172
subtarget="$(echo "${customtarget}" | cut -d'-' -f 1)"
173173
openwrt_release="$(echo "${{ matrix.openwrt }}" | cut -d'.' -f 1-2)"
174174
175+
if [ "${{ github.ref }}" = "refs/heads/weimarnetz-tng" ]; then
176+
FEED_CHANNEL="stable"
177+
else
178+
FEED_CHANNEL="testing"
179+
fi
180+
175181
# Process packages directory (unified feed structure)
176182
for feed_dir in packages/* ; do
177183
if [ -d "$feed_dir" ]; then
178184
feed_name=$(basename "$feed_dir")
179185
180-
# Create local structure: <openwrt_release>/<maintarget>/<subtarget>/<feed_name>
181-
mkdir -p "upload_temp/brauhaus/packages/$openwrt_release/$maintarget/$subtarget/$feed_name"
186+
# Create local structure: <channel>/<openwrt_release>/<maintarget>/<subtarget>/<feed_name>
187+
mkdir -p "upload_temp/brauhaus/packages/$FEED_CHANNEL/$openwrt_release/$maintarget/$subtarget/$feed_name"
182188
183189
# Copy the build info JSON
184-
cp ../build_info/package_build.json "upload_temp/brauhaus/packages/$openwrt_release/$maintarget/$subtarget/$feed_name/"
190+
cp ../build_info/package_build.json "upload_temp/brauhaus/packages/$FEED_CHANNEL/$openwrt_release/$maintarget/$subtarget/$feed_name/"
185191
186192
# Copy package files
187-
find "./$feed_dir" -maxdepth 1 -type f -exec cp {} "upload_temp/brauhaus/packages/$openwrt_release/$maintarget/$subtarget/$feed_name/" \;
193+
find "./$feed_dir" -maxdepth 1 -type f -exec cp {} "upload_temp/brauhaus/packages/$FEED_CHANNEL/$openwrt_release/$maintarget/$subtarget/$feed_name/" \;
188194
fi
189195
done
190196
191-
# Upload: -R/--relative + /./ in source builds $openwrt_release/... under dest without --mkpath (rrsync-friendly)
192-
echo "Uploading packages to /brauhaus/packages/$openwrt_release/$maintarget/$subtarget/"
197+
# Upload: -R/--relative + /./ in source builds $FEED_CHANNEL/... under dest without --mkpath (rrsync-friendly)
198+
echo "Uploading $FEED_CHANNEL packages to /brauhaus/packages/$FEED_CHANNEL/$openwrt_release/$maintarget/$subtarget/"
193199
rsync -avz --delete -R '-e ssh -o StrictHostKeyChecking=no -p22223' \
194-
"upload_temp/brauhaus/packages/./$openwrt_release/$maintarget/$subtarget/" \
200+
"upload_temp/brauhaus/packages/./$FEED_CHANNEL/$openwrt_release/$maintarget/$subtarget/" \
195201
"buildbot@buildbot.weimarnetz.de:/brauhaus/packages/"
196202
203+
# Summary job so branch protection only needs one required check instead of all matrix jobs
204+
build_status:
205+
needs: [compile_packages]
206+
if: always()
207+
runs-on: ubuntu-latest
208+
steps:
209+
- name: Check matrix result
210+
run: |
211+
if [ "${{ needs.compile_packages.result }}" != "success" ]; then
212+
echo "::error::At least one build in the matrix failed."
213+
exit 1
214+
fi
215+
197216
# Separate job that runs after all matrix jobs are completed
198217
trigger_firmware_build:
199218
needs: [collect_build_info, compile_packages]
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Version Check
2+
3+
on:
4+
pull_request:
5+
branches: [weimarnetz-tng]
6+
paths:
7+
- 'utils/*/**'
8+
- 'net/*/**'
9+
10+
jobs:
11+
check-version-bump:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v6
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Check that changed packages have a version bump
19+
run: |
20+
BASE="${{ github.event.pull_request.base.sha }}"
21+
FAILED=0
22+
23+
changed_dirs=$(git diff --name-only "$BASE"...HEAD -- 'utils/' 'net/' \
24+
| grep -oP '^(utils|net)/[^/]+' | sort -u)
25+
26+
if [ -z "$changed_dirs" ]; then
27+
echo "No package directories changed."
28+
exit 0
29+
fi
30+
31+
for pkg_dir in $changed_dirs; do
32+
makefile="$pkg_dir/Makefile"
33+
34+
if [ ! -f "$makefile" ]; then
35+
echo "::notice::$pkg_dir has no Makefile, skipping."
36+
continue
37+
fi
38+
39+
if ! git show "$BASE:$makefile" >/dev/null 2>&1; then
40+
echo "::notice::$makefile is new in this PR, skipping version check."
41+
continue
42+
fi
43+
44+
old_version=$(git show "$BASE:$makefile" \
45+
| grep -E '^PKG_(VERSION|RELEASE):=' | sort | tr '\n' '|')
46+
new_version=$(grep -E '^PKG_(VERSION|RELEASE):=' "$makefile" \
47+
| sort | tr '\n' '|')
48+
49+
if [ "$old_version" = "$new_version" ]; then
50+
echo "::error file=$makefile::$pkg_dir was changed but PKG_VERSION or PKG_RELEASE was not bumped."
51+
FAILED=1
52+
else
53+
echo "::notice file=$makefile::$pkg_dir version bump OK ($old_version -> $new_version)"
54+
fi
55+
done
56+
57+
if [ "$FAILED" -eq 1 ]; then
58+
echo ""
59+
echo "::error::At least one package was changed without a version bump. Please increment PKG_VERSION or PKG_RELEASE."
60+
exit 1
61+
fi

README.md

Lines changed: 21 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -17,60 +17,35 @@ Device packages must be space separated, prepend a `-` if you don't want a packa
1717

1818
In the `packagelist` repository you can configure packages that are globally installed. The suffixes after `_` correspond to the suffixes in the `profiles` directory. It is possible to define packages for every OpenWrt Build we support.
1919

20-
Currently we build images for OpenWrt 21.02 and OpenWrt 22.03.
20+
Currently we build packages for OpenWrt 24.10 and OpenWrt 25.12.
2121

22-
## Cross-Repository Builds
22+
## Package Versioning
2323

24-
This repository is responsible for developing and building OpenWrt packages. After a successful package build, a firmware build is automatically triggered in the [imagebuilder](https://github.com/weimarnetz/imagebuilder) repository.
24+
Every package must define `PKG_VERSION` and `PKG_RELEASE` in its Makefile:
2525

26-
### Workflow
26+
```makefile
27+
PKG_VERSION:=1.2.0
28+
PKG_RELEASE:=1
29+
```
2730

28-
1. Changes to package sources in this repository are pushed
29-
2. GitHub Actions compiles the packages for various target architectures
30-
3. The compiled packages are uploaded to the build server
31-
4. After all package builds complete successfully, a repository dispatch event is sent to the imagebuilder repository
32-
5. The imagebuilder repository then automatically starts its firmware builds using the latest packages
31+
- `PKG_VERSION` is the semantic version of the package. Bump it when the package content changes.
32+
- `PKG_RELEASE` is the packaging release counter. Bump it for packaging-only changes (e.g. dependency adjustments) and reset it to `1` when `PKG_VERSION` is incremented.
3333

34-
### Setting up Cross-Repository Communication
34+
A CI check on pull requests verifies that at least one of these values was incremented when package files are modified. The check must pass before the PR can be merged.
3535

36-
Communication between repositories is handled via a GitHub App. Here's how to set it up:
36+
## Releases and Feeds
3737

38-
1. **Create a GitHub App**:
39-
- Go to GitHub Settings → Developer settings → GitHub Apps → New GitHub App
40-
- Enter a name (e.g., "Weimarnetz Build Dispatcher")
41-
- Homepage URL: Repository or organization URL
42-
- Disable Webhook (not needed)
43-
- Under "Repository permissions":
44-
- **Metadata**: `Read-only`
45-
- **Contents**: `Read and write` (required for repository_dispatch)
46-
- Click "Create GitHub App"
38+
The `weimarnetz-tng` branch is the **stable** branch. All development happens in feature branches and is merged via pull requests.
4739

48-
2. **Install the App in repositories**:
49-
- After creation, select "Install App" in the left menu
50-
- Choose the "weimarnetz" organization
51-
- Select "Only select repositories" and mark both the packages and imagebuilder repositories
52-
- Click "Install"
40+
- **Stable feed**: Packages are built and uploaded automatically when a PR is merged into `weimarnetz-tng`.
41+
- **Testing feed**: Any branch can be built into the testing feed by manually triggering the build workflow via *Actions → Weimarnetz Package Build → Run workflow*.
5342

54-
3. **Generate App ID and Private Key**:
55-
- Return to the App configuration page
56-
- Note the "App ID" (a number)
57-
- Scroll down to "Private keys" and click "Generate a private key"
58-
- Save the downloaded file securely
43+
Devices can subscribe to either feed:
5944

60-
4. **Add Secrets to the repository**:
61-
- Go to repository settings → Secrets and variables → Actions
62-
- Create two new secrets:
63-
- `GH_APP_ID`: The App ID from step 3
64-
- `GH_APP_PRIVATE_KEY`: The contents of the downloaded private key file
45+
```
46+
# Stable (default)
47+
src/gz weimarnetz_stable https://buildbot.weimarnetz.de/brauhaus/packages/stable/<openwrt_release>/<target>/<subtarget>/weimarnetz
6548
66-
5. **Configure the workflow**:
67-
- The workflow `.github/workflows/assemblefirmware.yml` already contains the necessary configuration to trigger the imagebuilder after successful package builds
68-
69-
### Troubleshooting
70-
71-
If the cross-repository trigger doesn't work:
72-
73-
- Verify that the GitHub App has the correct permissions
74-
- Ensure the App is installed in both repositories
75-
- Check the secrets `GH_APP_ID` and `GH_APP_PRIVATE_KEY`
76-
- Review GitHub Actions logs for detailed error messages
49+
# Testing
50+
src/gz weimarnetz_testing https://buildbot.weimarnetz.de/brauhaus/packages/testing/<openwrt_release>/<target>/<subtarget>/weimarnetz
51+
```

utils/luci-app-owm/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
include $(TOPDIR)/rules.mk
99

1010
PKG_NAME:=luci-app-owm
11-
PKG_RELEASE:=0.8.0
11+
PKG_VERSION:=0.8.0
12+
PKG_RELEASE:=1
1213

1314
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
1415

utils/weimarnetz-button-config/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
include $(TOPDIR)/rules.mk
22

33
PKG_NAME:=weimarnetz-button-config
4-
PKG_RELEASE:=1.0.0
4+
PKG_VERSION:=1.0.0
5+
PKG_RELEASE:=1
56

67
define Package/weimarnetz-button-config
78
SECTION:=luci

utils/weimarnetz-metrics-exporter/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
include $(TOPDIR)/rules.mk
22

33
PKG_NAME:=weimarnetz-metrics-exporter
4-
PKG_RELEASE:=1.0.1
4+
PKG_VERSION:=1.0.1
5+
PKG_RELEASE:=1
56

67
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
78

utils/weimarnetz-owm-exporter/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
include $(TOPDIR)/rules.mk
22

33
PKG_NAME:=weimarnetz-owm-exporter
4-
PKG_RELEASE:=1.2.0
4+
PKG_VERSION:=1.2.0
5+
PKG_RELEASE:=1
56

67
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
78

0 commit comments

Comments
 (0)