|
7 | 7 |
|
8 | 8 | jobs: |
9 | 9 | # Build all packages for x86_64 |
10 | | - # use latest branch of openwrt with opkg to produce feed at https://feed.libremesh.org/profiles |
11 | | - # use main branch of openwrt with apk to produce feed at https://feed.libremesh.org/apk/profiles |
12 | | - # NOTE: this doesn't sign packages for apk |
| 10 | + generate_matrix: |
| 11 | + name: 'Generate matrix' |
| 12 | + runs-on: ubuntu-latest |
| 13 | + outputs: |
| 14 | + matrix_builds: ${{ steps.define_matrix.outputs.matrix_builds }} |
| 15 | + dest_dir: ${{ steps.set_package_destination.outputs.dest_dir }} |
| 16 | + steps: |
| 17 | + - name: Set package destination |
| 18 | + id: set_package_destination |
| 19 | + run: | |
| 20 | + export TAG=$(echo "${{ github.ref }}" | cut -d '/' -f 3- | perl -pe 's/v([0-9])/$1/') |
| 21 | + echo "$TAG" |
| 22 | + echo "DEST_DIR=$TAG" >> $GITHUB_OUTPUT |
| 23 | +
|
| 24 | + - name: Define matrix of branches and archs |
| 25 | + id: define_matrix |
| 26 | + run: | |
| 27 | + JSON='[' |
| 28 | + FIRST_BUILD=1 |
| 29 | + versions=$(curl https://downloads.openwrt.org/.versions.json) |
| 30 | + stable=$(echo $versions | jq | grep \"stable_ | sed 's|.*\"stable_version\": \"\(.*\)\",|\1|') |
| 31 | + oldstable=$(echo $versions | jq | grep oldstable_ | sed 's|.*\"oldstable_version\": \"\(.*\)\",|\1|') |
| 32 | +
|
| 33 | + for version in "main" "${stable:0:5}" "${oldstable:0:5}"; do |
| 34 | +
|
| 35 | + VERSION=$([ "$version" == "main" ] \ |
| 36 | + && echo "main" || echo "openwrt-$version") |
| 37 | + echo $VERSION |
| 38 | +
|
| 39 | + OPENWRT_BRANCH_PATH="openwrt-$version" |
| 40 | + echo $OPENWRT_BRANCH_PATH |
| 41 | +
|
| 42 | + PKG_MANAGER_PATH=$([ "$version" != "main" ] && [ "${version:0:2}" -lt 25 ] \ |
| 43 | + && echo "" || echo "apk/") |
| 44 | + |
| 45 | + [[ $FIRST_BUILD -ne 1 ]] && JSON="$JSON"',' |
| 46 | + FIRST_BUILD=0 |
| 47 | +
|
| 48 | + JSON="$JSON"'{"version": "'"$VERSION"'" , "pkg_manager_path": "'"$PKG_MANAGER_PATH"'", "openwrt_branch_path": "'"$OPENWRT_BRANCH_PATH"'" }' |
| 49 | + done |
| 50 | +
|
| 51 | + echo $JSON |
| 52 | +
|
| 53 | + matrix_include='{"include": '"$JSON"']}' |
| 54 | + echo "matrix_builds=${matrix_include}" >> "$GITHUB_OUTPUT" |
| 55 | +
|
13 | 56 | build: |
14 | | - name: Build profiles ${{ matrix.version }} |
| 57 | + name: Build ${{ matrix.openwrt_branch_path }} x86_64 |
15 | 58 | runs-on: ubuntu-latest |
| 59 | + needs: generate_matrix |
16 | 60 | strategy: |
17 | 61 | fail-fast: false |
18 | | - max-parallel: 1 |
19 | | - matrix: |
20 | | - include: |
21 | | - - { version: main, output_path: 'apk/'} |
22 | | - - { version: openwrt-24.10, output_path: ''} |
23 | | - |
| 62 | + matrix: ${{ fromJson(needs.generate_matrix.outputs.matrix_builds) }} |
24 | 63 | steps: |
25 | 64 | - uses: actions/checkout@v4 |
26 | 65 |
|
27 | | - - name: Build packages ${{ matrix.version }} |
28 | | - uses: openwrt/gh-action-sdk@v7 |
| 66 | + - name: Build packages |
| 67 | + uses: openwrt/gh-action-sdk@v9 |
29 | 68 | env: |
30 | | - ARCH: "x86_64-${{ matrix.version }}" |
| 69 | + ARCH: x86_64-${{ matrix.version }} |
31 | 70 | FEEDNAME: "profiles" |
32 | 71 | IGNORE_ERRORS: "n m y" |
33 | | - KEY_BUILD: "${{ matrix.version != 'main' && secrets.KEY_BUILD || '' }}" |
| 72 | + KEY_BUILD: "${{ secrets.KEY_BUILD }}" |
| 73 | + PRIVATE_KEY: "${{ secrets.PRIVATE_KEY }}" |
34 | 74 | INDEX: 1 |
35 | 75 | NO_DEFAULT_FEEDS: 1 |
36 | 76 | NO_REFRESH_CHECK: 1 |
37 | 77 | NO_SHFMT_CHECK: 1 |
| 78 | + # V: sc |
| 79 | + |
| 80 | + - name: Prepare artifacts paths |
| 81 | + run: | |
| 82 | + bin_path="bin_dir/${{ matrix.openwrt_branch_path }}/x86_64" |
| 83 | + mkdir -p "$bin_path" |
| 84 | + mv bin/packages/x86_64/profiles/* "$bin_path" |
| 85 | +
|
| 86 | + - name: Upload artifact |
| 87 | + uses: actions/upload-artifact@v4 |
| 88 | + with: |
| 89 | + name: ${{ matrix.openwrt_branch_path }} |
| 90 | + path: bin_dir/ |
| 91 | + |
| 92 | + publish: |
| 93 | + name: Publish |
| 94 | + runs-on: ubuntu-latest |
| 95 | + if: ${{ always() }} |
| 96 | + needs: [generate_matrix, build] |
| 97 | + steps: |
| 98 | + - uses: actions/checkout@v4 |
| 99 | + |
| 100 | + - name: Checkout lime-feed |
| 101 | + uses: actions/checkout@v4 |
| 102 | + with: |
| 103 | + repository: libremesh/lime-feed |
| 104 | + path: lime-feed |
| 105 | + |
| 106 | + - uses: actions/download-artifact@v4 |
| 107 | + with: |
| 108 | + merge-multiple: true |
| 109 | + path: artifacts/profiles/ |
| 110 | + |
| 111 | + - name: Replace packages |
| 112 | + run: | |
| 113 | + for branch in $(ls artifacts/profiles/); do |
| 114 | + rm -rf lime-feed/profiles/$branch/x86_64 |
| 115 | + done; |
| 116 | + cp -r artifacts/profiles/* lime-feed/profiles/ |
38 | 117 |
|
39 | 118 | - name: Upload packages to GitHub Pages |
40 | 119 | uses: peaceiris/actions-gh-pages@v4 |
41 | 120 | with: |
42 | 121 | deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} |
43 | 122 | external_repository: libremesh/lime-feed |
44 | | - publish_dir: bin/packages/x86_64/profiles/ |
45 | | - destination_dir: ${{ matrix.output_path }}profiles |
| 123 | + publish_dir: ./lime-feed/profiles/ |
| 124 | + destination_dir: profiles |
0 commit comments