Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wehagy committed May 20, 2024
0 parents commit e8b1aa4
Show file tree
Hide file tree
Showing 10 changed files with 1,011 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Action to build openwrt images
---
name: build openwrt images

on:
# Allows manual workflow run (must in default branch to work)
workflow_dispatch:
workflow_call:
inputs:
commit_long_sha:
required: true
type: string
# push:
# branches:
# - main
# paths:
# - 'custom-feed/**'

jobs:
build-openwrt-image:
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
- name: Upload openwrt tplink_archer-c7-v4 image artifacts
uses: actions/upload-artifact@v4
with:
name: openwrt-image.tplink_archer-c7-v4
path: build-output.tplink_archer-c7-v4*

- name: Upload openwrt totolink_x5000r image artifacts
uses: actions/upload-artifact@v4
with:
name: openwrt-image.totolink_x5000r
path: build-output.totolink_x5000r*
42 changes: 42 additions & 0 deletions .github/workflows/compare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Action to build openwrt images
---
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: |
podman -v
.github/workflows/scripts/compare-release
- 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 }}
22 changes: 22 additions & 0 deletions .github/workflows/scripts/compare-release
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 [[ "${LOCAL_TAG_STRIP}" = "${REMOTE_TAG_STRIP}" ]]; then
echo "ok"
else
echo "not ok"
sed -i "s/\(PKG_VERSION:=\).*/\1${REMOTE_TAG_STRIP}/" custom-feed/netbird/Makefile
curl -slL 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build-output/
Loading

0 comments on commit e8b1aa4

Please sign in to comment.