From d796a2622ae76c8780f56c0f80a03543594f8487 Mon Sep 17 00:00:00 2001

From: origami74@gmail.com

Date: Fri, 2 May 2025 14:20:56 +0200

Subject: [PATCH 1/2] Custom tags:

add release channel

undo tag trigger

trigger on tag (release)2

trigger on tag (release)

set os version based on tag/branch

differentiate openwrt and OS version

use key/value instead of json

typo

no subpath

use custom branch for nip94 publish

custom tags implemented

---

.github/workflows/build-firmware.yml | 30 ++++++++++++++++++++++++++++--

actions/build-firmware/action.yml | 31 ++++++++++++++++++++-----------

2 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/.github/workflows/build-firmware.yml b/.github/workflows/build-firmware.yml

index a41719d..b4473c8 100644

--- a/.github/workflows/build-firmware.yml

+++ b/.github/workflows/build-firmware.yml

@@ -1,4 +1,4 @@

-name: Build OpenWRT Firmware

+name: Build TollGate OS (OpenWRT Firmware)

on:

push:

@@ -29,7 +29,30 @@ jobs:

steps:

- uses: actions/checkout@v4

-

+

+ - id: commit-hash

+ uses: prompt/actions-commit-hash@v3

+

+ - name: Set version variable

+ id: determine-os-version

+ run: |

+ if [[ $GITHUB_REF == refs/tags/* ]]; then

+ # If this is a tag push, use the tag name

+ echo "version=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT

+ else

+ # If this is a branch push, use branch-shortCommitHash format

+ echo "version=${GITHUB_REF_NAME}-${{ steps.commit-hash.outputs.short }}" >> $GITHUB_OUTPUT

+ fi

+

+ - name: Set version variable

+ id: determine-release-channel

+ run: |

+ if [[ $GITHUB_REF == refs/tags/* ]]; then

+ echo "channel=stable" >> $GITHUB_OUTPUT

+ else

+ echo "channel=dev" >> $GITHUB_OUTPUT

+ fi

+

- name: Build OpenWRT Image

id: build-openwrt-image

uses: ./actions/build-firmware

@@ -40,6 +63,9 @@ jobs:

files_path: "./files"

nsecbech: ${{ secrets.NSECBECH }}

nsec: ${{ secrets.NSEC }}

+ # openwrt_version: '24.10.1'

+ tollgate_os_version: ${{ steps.determine-os-version.outputs.version }}

+ release_channel: ${{ steps.determine-release-channel.outputs.channel }}

- name: Upload Firmware Artifact

uses: actions/upload-artifact@v4

diff --git a/actions/build-firmware/action.yml b/actions/build-firmware/action.yml

index 9aa5127..280971f 100644

--- a/actions/build-firmware/action.yml

+++ b/actions/build-firmware/action.yml

@@ -10,9 +10,15 @@ inputs:

model:

description: 'The device model to build for'

required: true

- version:

+ openwrt_version:

description: 'OpenWRT version'

default: '23.05.3'

+ tollgate_os_version:

+ description: 'TollGate OS version'

+ default: 'v0.0.0'

+ release_channel:

+ description: 'TollGate OS release channel (stable, dev, beta, etc)'

+ default: 'dev'

nostr_secret_key:

description: 'Nostr secret key'

required: true

@@ -127,17 +133,17 @@ runs:

run: |

mkdir -p $BUILDDIR

- if [ "${{ inputs.version }}" = "snapshot" ]; then

+ if [ "${{ inputs.openwrt_version }}" = "snapshot" ]; then

IMAGEBUILDER_NAME="openwrt-imagebuilder-${PLATFORM}-${TYPE}.Linux-x86_64"

DOWNLOAD_URL="https://downloads.openwrt.org/snapshots/targets/${PLATFORM}/${TYPE}/${IMAGEBUILDER_NAME}.tar.zst"

echo "ARCHIVE_EXT=tar.zst" >> $GITHUB_ENV

elif [ "${PLATFORM}" = "ath79" ] && [ "${TYPE}" = "nand" ]; then

- IMAGEBUILDER_NAME="openwrt-imagebuilder-${{ inputs.version }}-ath79-nand.Linux-x86_64"

- DOWNLOAD_URL="https://downloads.openwrt.org/releases/${{ inputs.version }}/targets/${PLATFORM}/${TYPE}/${IMAGEBUILDER_NAME}.tar.xz"

+ IMAGEBUILDER_NAME="openwrt-imagebuilder-${{ inputs.openwrt_version }}-ath79-nand.Linux-x86_64"

+ DOWNLOAD_URL="https://downloads.openwrt.org/releases/${{ inputs.openwrt_version }}/targets/${PLATFORM}/${TYPE}/${IMAGEBUILDER_NAME}.tar.xz"

echo "ARCHIVE_EXT=tar.xz" >> $GITHUB_ENV

else

- IMAGEBUILDER_NAME="openwrt-imagebuilder-${{ inputs.version }}-${TARGET_DEVICE}.Linux-x86_64"

- DOWNLOAD_URL="https://downloads.openwrt.org/releases/${{ inputs.version }}/targets/${PLATFORM}/${TYPE}/${IMAGEBUILDER_NAME}.tar.xz"

+ IMAGEBUILDER_NAME="openwrt-imagebuilder-${{ inputs.openwrt_version }}-${TARGET_DEVICE}.Linux-x86_64"

+ DOWNLOAD_URL="https://downloads.openwrt.org/releases/${{ inputs.openwrt_version }}/targets/${PLATFORM}/${TYPE}/${IMAGEBUILDER_NAME}.tar.xz"

echo "ARCHIVE_EXT=tar.xz" >> $GITHUB_ENV

fi

@@ -150,7 +156,7 @@ runs:

cd $BUILDDIR

if curl --output /dev/null --silent --head --fail "$DOWNLOAD_URL"; then

curl -L -C - -O "$DOWNLOAD_URL"

- if [ "${{ inputs.version }}" = "snapshot" ]; then

+ if [ "${{ inputs.openwrt_version }}" = "snapshot" ]; then

tar --zstd -xf "${IMAGEBUILDER_NAME}.${ARCHIVE_EXT}"

else

tar xfJ "${IMAGEBUILDER_NAME}.${ARCHIVE_EXT}"

@@ -460,7 +466,7 @@ runs:

- name: Publish Firmware NIP-94 Metadata

id: publish_firmware

- uses: OpenTollGate/nostr-publish-file-metadata-action/python@main

+ uses: OpenTollGate/nostr-publish-file-metadata-action@feature/custom-tags

with:

relays: ${{ inputs.nostr_relays }}

url: ${{ steps.upload_firmware.outputs.url }}

@@ -471,9 +477,12 @@ runs:

content: "TollGate OS Firmware for ${{ inputs.model }}"

nsec: ${{ inputs.nsec }}

size: ${{ env.FIRMWARE_SIZE }}

- architecture: ${{ env.BLOSSOM_ARCH }}

- model: ${{ inputs.model }}

- version: ${{ inputs.version }}

+ customTags: |

+ architecture=${{ env.BLOSSOM_ARCH }}

+ model=${{ inputs.model }}

+ openwrt_version=${{ inputs.openwrt_version }}

+ tollgate_os_version=${{ inputs.tollgate_os_version }}

+ release_channel=${{ inputs.release_channel }}

- name: Verify Firmware Publication

id: verify_firmware

--

libgit2 1.8.1

Reply to this note

Please Login to reply.

Discussion

No replies yet.