Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Pashmfouroush <[email protected]>
  • Loading branch information
markpash committed Nov 26, 2024
1 parent 7ba08f6 commit 2015b4b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 55 deletions.
48 changes: 7 additions & 41 deletions .github/workflows/build-firmware.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Build the Neighbor Link Firmware

on:
push:
branches: [main]
release:
types: [published]

jobs:
build:
Expand All @@ -14,12 +15,6 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

- name: Source Release Version
run: |
source RELEASE_VERSION
echo "release_version=$release_version"
echo "release_version=$release_version" >> $GITHUB_ENV
- name: Set up Build Environment
run: |
sudo apt-get update -y
Expand All @@ -31,49 +26,20 @@ jobs:
- name: Build the Firmware
run: |
cd src
bash build.bash ${{ env.release_version }}
echo "release_version=$release_version" >> build/RELEASE_VERSION
bash build.bash ${{ github.ref }}
echo "release_version=${{ github.ref }}" >> build/RELEASE_VERSION
- name: Upload Build Artifacts as a Single Artifact
uses: actions/upload-artifact@v4
with:
name: build-artifacts
name: ${GITHUB_SHA::6}
path: src/build/*

release:
runs-on: ubuntu-22.04
needs: build

steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: artifacts

- name: Source Release Version
run: |
source artifacts/RELEASE_VERSION
echo "release_version=$release_version"
echo "release_version=$release_version" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.release_version }}
release_name: Neighbor-Link v${{ env.release_version }}
draft: false
prerelease: false
body: |
This is a release for the Neighbor Link Firmware.
- name: Attach Artifacts to Release
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/*
tag: v${{ env.release_version }}
tag: ${{ github.ref }}
file_glob: true
27 changes: 13 additions & 14 deletions src/build.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

#!/bin/bash
#!/usr/bin/env bash

# This script is designed to run on Ubuntu systems with AMD64 architecture.
# Please ensure you are running this script on a compatible system.
Expand Down Expand Up @@ -43,42 +42,42 @@ for target in "${target_info[@]}"; do
IFS=' ' read -r profile cpu_arch chipset device_model <<< "$target"

PATH_PART="$wrt_version-$cpu_arch-$chipset"

download_url="https://archive.openwrt.org/releases/$wrt_version/targets/$cpu_arch/$chipset/openwrt-imagebuilder-$PATH_PART.Linux-x86_64.tar.xz"

rm -rf openwrt-imagebuilder-*
wget $download_url
tar -J -x -f openwrt-imagebuilder-$PATH_PART.Linux-x86_64.tar.xz 2>/dev/null > /dev/null
curl -fsSL "$download_url" -O
tar -J -x -f openwrt-imagebuilder-"$PATH_PART".Linux-x86_64.tar.xz 2>/dev/null > /dev/null

sed -i "s/option version .*/option version '$release_version'/" "files/etc/config/routro"
IMAGEBUILDER_REPO="openwrt-imagebuilder-$PATH_PART.Linux-x86_64"
cd $IMAGEBUILDER_REPO
cd "$IMAGEBUILDER_REPO"

TEXT_FILE=../$BUILD_DIR/version-$device_model.txt
echo "new_version=$release_version" > $TEXT_FILE
echo "new_version=$release_version" > "$TEXT_FILE"

#Make the images
make image PROFILE=$profile PACKAGES="$INCLUDE_PACKAGES $EXCLUDE_PACKAGES" FILES=$FILES
make image PROFILE="$profile" PACKAGES="$INCLUDE_PACKAGES $EXCLUDE_PACKAGES" FILES=$FILES

dest_of_bin="bin/targets/$arch/$chip/"
dest_of_bin="bin/targets/$cpu_arch/$chipset/"

# Loop over the files with .bin extension in the bin/ directory
for file in $(find $dest_of_bin -type f -name "*.bin"); do
for file in $(find "$dest_of_bin" -type f -name "*.bin"); do

newname=$(echo "$file" | sed " s|openwrt-$PATH_PART-$profile-|$device_model-$release_version-| " )

newname=$(echo $file | sed " s|openwrt-$PATH_PART-$profile-|$device_model-$release_version-| " )

newfile=../$BUILD_DIR/$(basename "$newname")
echo "$newfile:"
# Rename the file
mv "$file" $newfile
mv "$file" "$newfile"

if [[ "$file" == *"sysupgrade"* ]];then
filename=$(basename "$newname" )
echo "firmwareUrl=https://github.com/nasnet-community/neighbor-link/blob/0f2001dd371d02357248beb61ec9a812d82a743a/builds/$filename" >> $TEXT_FILE
fi

done

cd ../

done

0 comments on commit 2015b4b

Please sign in to comment.