-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Wesley Gimenes <[email protected]>
- Loading branch information
0 parents
commit 76324e2
Showing
11 changed files
with
1,183 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Action to build openwrt images | ||
--- | ||
name: build openwrt images | ||
|
||
on: | ||
# Allows manual workflow run (must in default branch to work) | ||
workflow_dispatch: | ||
# Allows workflow be reusable | ||
workflow_call: | ||
inputs: | ||
commit_long_sha: | ||
required: true | ||
type: string | ||
# push: | ||
# branches: | ||
# - main | ||
# paths: | ||
# - 'custom-feed/**' | ||
|
||
jobs: | ||
build-openwrt-image: | ||
strategy: | ||
matrix: | ||
image: | ||
# W | ||
- "x86 64 generic" | ||
- "ath79 generic tplink_archer-c7-v4" | ||
- "mediatek filogic xiaomi_mi-router-ax3000t-ubootmod" | ||
# P | ||
- "ramips mt7621 totolink_x5000r" | ||
- "mediatek filogic bananapi_bpi-r3" | ||
|
||
runs-on: ubuntu-24.04 | ||
|
||
steps: | ||
- name: Checkout repo from main if run from compare-release | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.commit_long_sha }} | ||
|
||
# - name: Build image | ||
# run: | | ||
# ./openwrt-builder.sh ${{ matrix.image }} | ||
|
||
- name: Prepare artifact name | ||
run: | | ||
artifact_name=${{ matrix.image }} | ||
echo "artifact_name=${artifact_name##* } >> "$GITHUB_ENV" | ||
echo "${artifact_name}" > "${artifact_name}".txt | ||
- name: Upload openwrt image artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: {{ env.artifact_name }} | ||
path: {{ env.artifact_name }}.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Action to compare if the latest version, | ||
# if not, push commit and build | ||
--- | ||
name: compare release | ||
|
||
on: | ||
# Allows manual workflow run (must in default branch to work) | ||
workflow_dispatch: | ||
|
||
jobs: | ||
compare-release: | ||
runs-on: ubuntu-24.04 | ||
permissions: | ||
contents: write | ||
outputs: | ||
committed: ${{ steps.commit.outputs.committed }} | ||
commit_long_sha: ${{ steps.commit.outputs.commit_long_sha }} | ||
|
||
steps: | ||
- name: Checkout repo | ||
id: checkout-repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: compare | ||
id: compare | ||
run: | | ||
.github/workflows/scripts/compare-release.sh | ||
- name: commit | ||
id: commit | ||
if: ${{ steps.compare.outputs.sha256 != '' }} | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
commit: --signoff | ||
default_author: github_actions | ||
|
||
build-openwrt-images: | ||
needs: compare-release | ||
if: ${{ needs.compare-release.outputs.committed == 'true' }} | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
commit_long_sha: ${{ needs.compare-release.outputs.commit_long_sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
REPO="netbirdio/netbird" | ||
REMOTE_TAG="$(git ls-remote --refs --sort='-version:refname' --tags https://github.com/"${REPO}".git | head --lines=1 | cut --delimiter='/' --fields=3)" | ||
REMOTE_TAG_STRIP="$(t="${REMOTE_TAG}" && echo "${t:1}")" | ||
LOCAL_TAG="$(grep 'PKG_VERSION:=' custom-feed/netbird/Makefile)" | ||
LOCAL_TAG_STRIP="$(t="${LOCAL_TAG}" && echo "${t:13}")" | ||
|
||
if [[ "$(printf '%s\n%s' "${REMOTE_TAG_STRIP}" "${LOCAL_TAG_STRIP}" | sort --version-sort --check=quiet; echo "${?}")" == 0 ]]; then | ||
echo "ok" | ||
else | ||
echo "not ok" | ||
curl -sL https://github.com/"${REPO}"/archive/refs/tags/"${REMOTE_TAG}".tar.gz -o "${REPO##*/}"-"${REMOTE_TAG_STRIP}".tar.gz | ||
SHA256="$(sha256sum "${REPO##*/}"-"${REMOTE_TAG_STRIP}".tar.gz | head -c 64 && rm "${REPO##*/}"-"${REMOTE_TAG_STRIP}".tar.gz)" | ||
sed -i "s/\(PKG_HASH:=\).*/\1${SHA256}/" custom-feed/netbird/Makefile | ||
sed -i "s/\(PKG_VERSION:=\).*/\1${REMOTE_TAG_STRIP}/" custom-feed/netbird/Makefile | ||
if [[ "${GITHUB_ACTIONS}" = "true" ]]; then | ||
echo "sha256=${SHA256}" >> "${GITHUB_OUTPUT}" | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
REPO="netbirdio/netbird" | ||
REMOTE_TAG="$(curl -sL https://api.github.com/repos/"${REPO}"/releases/latest | jq -r '.tag_name')" | ||
REMOTE_TAG_STRIP="$(t="${REMOTE_TAG}" && echo "${t:1}")" | ||
LOCAL_TAG="$(grep PKG_VERSION:= custom-feed/netbird/Makefile)" | ||
LOCAL_TAG_STRIP="$(t="${LOCAL_TAG}" && echo "${t:13}")" | ||
|
||
if [[ "$(printf '%s\n%s' "${REMOTE_TAG_STRIP}" "${LOCAL_TAG_STRIP}" | sort --version-sort --check=quiet; echo "${?}")" == 0 ]]; then | ||
echo "ok" | ||
else | ||
echo "not ok" | ||
sed -i "s/\(PKG_VERSION:=\).*/\1${REMOTE_TAG_STRIP}/" custom-feed/netbird/Makefile | ||
curl -sL https://github.com/"${REPO}"/archive/refs/tags/"${REMOTE_TAG}".tar.gz -o temp_pkg | ||
SHA256="$(sha256sum temp_pkg | head -c 64 && rm temp_pkg)" | ||
sed -i "s/\(PKG_HASH:=\).*/\1${SHA256}/" custom-feed/netbird/Makefile | ||
if [[ "${GITHUB_ACTIONS}" = "true" ]]; then | ||
echo "sha256=${SHA256}" >> "${GITHUB_OUTPUT}" | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/bin/ |
Oops, something went wrong.